Does any one remember the difference between constant pointer and pointer to a constant.
I have three declaration:
const int *ptr;
int const *ptr;
int *const ptr;
I have three declaration:
const int *ptr;
int const *ptr;
int *const ptr;
The first two are the same: Pointer to a constant integer (The pointer variable can point to any constant integer but the variable pointed to cant be changed)
ReplyDeleteThe third one is a constant pointer to an integer (The value in the integer can be changed but the pointer cannot point to any other variable)
An easy way to find out is to read the definition from right to left.