Engineering
Engineering, 03.12.2019 18:31, oglejack6138

The subparts to this problem involve errors in the use ofpointers. a. this program is supposed to write 30 20 10, but it doesn't. find all ofthe bugs and show a fixed version of the program: int main() { intarr[3]={5,10,15}; int *ptr = arr; *ptr = 10; // set arr[0] to 10 *ptr + 1 = 20; // set arr[1] to 20 ptr +=2; ptr[0] = 30; // set arr[2] to 30 while (ptr > = arr) { ptr--; cout < < ' '< < *ptr; // print values } cout < endl; } b. the finddisorder function is supposed to find the first item in an array that is less than the element preceding it, and set the p parameter to point to that item, so the caller can know the location of that item. explain why this function won't do that, and show how to fix it. your fix must be to the function only; you must not change the the main routine below in any way, yet as a result of your fixing the function, the main routine below must work correctly. void finddisorder(int arr[], int n, int* p) { for(int k=1; k

answer
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 15:10, brooklyn674
Apiston-cylinder with a volume of 0.25 m3 holds 1 kg of air (r 0.287 k/kgk) at a temperature of 100 c. heat transfer to the cylinder causes an isothermal expansion of the piston until the volume triples. how much heat is added to the piston-cylinder?
Answers: 3
image
Engineering, 04.07.2019 18:20, karatsgrande3772
Determine the damped natural frequencies and the steady state response of a decoupled damped forced two degrees of freedom system. 10ä1 + 2q1 20q1 10 cos t; 10q2 +4q2 + 40q2 10 cos t
Answers: 3
image
Engineering, 04.07.2019 18:20, cdyshaylia55
Water vapor initially at 10 bar and 400 °c is contained within a piston-cylinder assembly. the water lost heat to the surrounding according to isochoric (iso-volumetric) process until its temperature is 150 °c. the water is then condensed isothermally to saturated liquid. for the water as a system, calculate the work in kj/kg
Answers: 2
image
Engineering, 04.07.2019 19:20, rida10309
At steady state, air at 200 kpa, 325 k, and mass flow rate of 0.5 kg/s enters an insulated duct having differing inlet and exit cross-sectional areas. the inlet cross-sectional area is 6 cm2. at the duct exit, the pressure of the air is 100 kpa and the velocity is 250 m/s. neglecting potential energy effects and modeling air as an 1.008 kj/kg k, determine ideal gas with constant cp = (a) the velocity of the air at the inlet, in m/s. (b) the temperature of the air at the exit, in k. (c) the exit cross-sectional area, in cm2
Answers: 2
Do you know the correct answer?
The subparts to this problem involve errors in the use ofpointers. a. this program is supposed to wr...

Questions in other subjects:

Konu
English, 25.05.2021 06:20