Each of the following declarations and program segments has errors. Locate as many as you can. A) int ptr*; B) int x, *ptr; &x = ptr; C) int x, *ptr; *ptr = &x; D) int x, *ptr; ptr = &x; ptr = 100; //...



Each of the following declarations and program segments has errors. Locate as many


as you can.


A) int ptr*;


B) int x, *ptr;


&x = ptr;


C) int x, *ptr;


*ptr = &x;


D) int x, *ptr;


ptr = &x;


ptr = 100; // Store 100 in x


cout <>


E) int numbers[] = {10, 20, 30, 40, 50};


cout <>


cout <>


F) int values[20], *iptr;


iptr = values;


iptr *= 2;


G) double level;


int dPtr = &level;


H) int *iptr = &ivalue;


int ivalue;


I) void doubleVal(int val)


{


*val *= 2;


}


J) int *pint;


new pint;


K) int *pint;


pint = new int;


pint = 100;


L) int *pint;


pint = new int[100]; // Allocate memory



.



.


Process the array



.



.


delete pint;// Free memory


M) int *getNum()


{



int wholeNum;



cout <>



cin >> wholeNum;



return &wholeNum;


}



May 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here