
Hiep L. answered 04/27/19
Current Computer Science Professor with 30+ yrs of IT experience
const char * ptr means that the character pointer (ptr) variable is pointing to data (in memory) that is constant (the data itself can not be changed by this pointer because the pointer is "promised" not to change it with the keyword const at the beginning of the variable declaration).
char * const ptr means that the character pointer (ptr) variable itself is constant, but the data that it points to can change. In other words, the variable itself says that it is ONLY pointing to this particular character in memory and will not be used to point to another location somewhere else. The best way to remember this is the keyword const is right next to the variable name (ptr) so that variable is promised to be fixed (not changeable), whereas the former explanation has the word const next to the data type (char) so the data is fixed (not changeable).
Hope this explanation helps.