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

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 16:10, TheOriginalMeyah
An electrical motor raises a 50kg load at a construct velencity .calculate the power of the motor, if it takes 40sec to raise the load through a height of 24m(take g =9.8n/g)
Answers: 2
image
Engineering, 04.07.2019 18:10, lillygrl100
For the closed feedwater heater below, feedwater enters state 3 at a pressure of 2000 psia and temperature of 420 °f at a rate of ix10 ibhr. the feedwat extracted steam enters state 1 at a pressure of 1000 psia and enthalpy of 1500 btu/lbm. the extracted er leaves at an enthalpy of 528.7 btu/lbm steam leaves as a saturated liquid. (16) a) determine the mass flow rate of the extraction steam used to heat the feedwater (10) b) determine the terminal temperature difference of the closed feedwater heater
Answers: 3
image
Engineering, 04.07.2019 18:10, michellerosas
Ajournal bearing has a journal diameter of 3.250 in with a unilateral tolerance of 20.003 in. the bushing bore has a diameter of 3.256 in and a unilateral tolerance of 0.004 in. the bushing is 2.8 in long and supports a 700-lbf load. the journal speed is 900 rev/min. find the minimum oil film thickness and the maximum film pressure for both sae 20 and sae 20w-30 lubricants, for the tightest assembly if the operating film temperature is 160°f. a computer code is appropriate for solving this problem.
Answers: 3
image
Engineering, 04.07.2019 18:10, Talos02
Burgers vector is generally parallel to the dislocation line. a)-true b)-false
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 in other subjects: