Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1 int *ptr; int val = 1; ptr = val; The second statement in the above code will

ID: 3579776 • Letter: 1

Question

1
int *ptr; int val = 1;
ptr = val;
The second statement in the above code will assign the value 1 to the pointer.
A) True
B) False

2
int a[5]; int *ptr;

ptr = a;

a. the second statement will assign the address of the first element in the array

b. the statements will cause a compilation time error

c. the statements will cause the program to stop running

d. none of the above

a. the second statement will assign the address of the first element in the array

b. the statements will cause a compilation time error

c. the statements will cause the program to stop running

d. none of the above

Explanation / Answer

1.int *ptr; int val = 1;
ptr = val;
The second statement in the above code will assign the value 1 to the pointer.

Answer: False

2. Answer: Option : a. the second statement will assign the address of the first element in the array