The way i normally reminds people how they can interpret it is like follow these simple steps:
- const keyword will be first applied to whatever we write on its left side
- If there is nothing on its left side it will applied to whatever it is written on its right side
Back to your question:
const int* samplePtr;
/* samplePtr is a pointer to constant integer, this means you can update the
pointer but not its content */
const int* const samplePtr;
/*Here we have two constant, the most left one is same as previous example it
will be applied to int, but the right most one is applied to * this time.
In summary samplePtr is a constant pointer that points to a constant integer.
In other words, neither of the pointer and its content can be modified later*/
int const * samlePtr;
/* I did not this format very often but it is exactly same as first one
"const int * samplePtr" */
In summary i can say "const T" and "T const are identical"