Categories
Difference and purpose of const T *p and T *const p?
Why do we need pointers to a constant data type and a constant pointer to a data type, and what is the difference?
Answer the question
In order to leave comments, you need to log in
const T *p - the pointer can be changed, the data it points to is not. T *const p - the pointer cannot be changed, but the data can be changed. Usage - e.g. implementing the principle of least privilege
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question