Global Constant Pointer
Back to C++ fundamentals.
Given two declarations of global variables:
char const * banana = “banana”;
char const * const apple = “apple”;
Both banana and apple point to a constant character, but banana is not declared as const. What does this mean? banana can point to other values, while apple can’t. Then apple is safer than banana because as a global variable, apple always points to the constant character, while banana can be changed by accident. For instance, if there’s a variable of a class also named as “banana”, and share the same type as the global variable, when some functions of the class change “banana”, it’s possible that the global variable is changed, which causes incorrect value of the global variable when it’s used in other places.