Question.4
A developer writes:
int arr[5] = {1, 2, 3, 4, 5}; int *p1 = arr; int (*p2)[5] = &arr;
What is the difference between p1 and p2?
Select Answer
No difference — both point to arr[0]
arr[0]
p1 points to the first int element; p2 points to the entire 5-element array — p2 + 1 jumps 20 bytes, p1 + 1 jumps 4 bytes
p1
p2
p2 + 1
p1 + 1
p2 is invalid — you cannot take the address of an array
p1 is a pointer; p2 is just an alias for arr