First of all, what\'s the difference between:
(1) const char*
(2) char const*
(3) const char const*
I\'m fairly certain I understand this f
There are quite a lot correct answers here but you may find it hard to remember, here is a trick to memorize this :
1> when const is on the left hand side of *, it means the pointer points to a constant object;
e.g.const int * p
means the int cannot be changed via pointer p
2> when const is on the right hand side of *, it means the pointer is a const pointer;
e.g.int * const p
means p is a constant pointer which cannot be changed.
BTW if you have const on both side of *, then it means it's a const pointer and you cannot change the object via the pointer.
e.g. int const * const p