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};
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;
cin >> wholeNum;
return &wholeNum;
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here