In the declaration int *const p = &x;, what is constant?
Correct answer A. The pointer p itself, which cannot be made to point elsewhere
Explanation
Read the declaration from the name outwards: p is a const pointer to int. const after the * applies to the pointer, so p = &y is an error, but *p = 5 is allowed. In const int *p the const is before the *, so the int is read-only through p while p can be reassigned. const int *const p makes both constant.
Answer checked How we write and check questions
Discussion