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, 04.07.2019 18:10
Fluids at rest possess no flow energy. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:10
Items are similar to the free issue items, but their access is limited. (clo5) a)-bin stock items free issue b)-bin stock controlled issue c)-critical or insurance spares d)-rebuildable spares e)-consumables
Answers: 1
question
Engineering, 04.07.2019 18:10
Calculate the bore of a cylinder that has a stroke of 18 inches and an extension time of 6 seconds at a flow rate of 4 gal/min.
Answers: 3
question
Engineering, 04.07.2019 18:10
The flow rate of air through a through a pipe is 0.02 m5/s. a pitot static tube is placed in the flow. the radius of the pitot static tube is 1 mm. assuming the flow to be steady and the air to be at 300k, calculate the difference in total and static pressure if the diameter of the pipe is: (a) d 0.1 m d 0.05 m (c) d 0.01 m
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
Chemistry, 27.09.2020 04:01
question
Mathematics, 27.09.2020 04:01
question
Chemistry, 27.09.2020 04:01
question
Biology, 27.09.2020 04:01
question
Mathematics, 27.09.2020 04:01
question
Mathematics, 27.09.2020 04:01
Questions on the website: 13722363