const Pointers
Where `const` sits decides what is read-only.
Easy
const int *p — can't change the value through p; int *const p — can't change p itself; const int *const p — neither. Use const on pointer parameters you don't modify.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.