What is difference between int const * p and int * const p

Answer:

int  const  * p

In the above declaration p is pointing to const integer variable i.e. with the help of pointer p we cannot modify then content of variable which pointer p is pointing.

int * const p

In the above declaration p is constant pointer i.e. we cannot modify pointer p.

Good example

No comments: