Q
Given int arr[5]; int *p = arr; with 4-byte ints, how many bytes does p + 2 advance from arr?
-
A
16 bytes
-
B
2 bytes
-
C
8 bytes
-
D
4 bytes
Correct Answer:
C. 8 bytes
Explanation:
Pointer arithmetic is scaled by the size of the pointed-to type: 2 × sizeof(int) = 8 bytes.