subject
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

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
question
Engineering, 04.07.2019 12:10
On a average work day more than work place firs are reorted
Answers: 1
question
Engineering, 04.07.2019 18:10
Abrake has a normal braking torque of 2.8 kip in and heat-dissipating cast-iron surfaces whose mass is 40 lbm. suppose a load is brought to rest in 8.0 s from an initial angular speed of 1600 rev/min using the normal braking torque; estimate the temperature rise of the heat dissipating surfaces.
Answers: 3
question
Engineering, 04.07.2019 18:10
Afluid flows with a velocity field given by v=(x/t)i.. determine the local and convective accelerations when x=3 and t=1.
Answers: 2
You know the right answer?
The subparts to this problem involve errors in the use ofpointers. a. this program is supposed to wr...
Questions
question
Mathematics, 10.03.2021 16:40
question
English, 10.03.2021 16:40
question
History, 10.03.2021 16:40
question
Chemistry, 10.03.2021 16:40
Questions on the website: 13722362