After studying for a long time, I made a mistake during the written examination. Send a log to commemorate it.
In fact, this concept is very similar to the following three methods:
Bjarne provides a mnemonic method in his c ++ programming language:
Read a statement from the right to the left.
Char * const CP; (* read as pointer to) CP is a const pointer to Char
Const char * P; P is a pointer to const char;
Char const * P; the same as C ++ does not have the const * operator, so const can only belong to the previous type.
The C ++ standard stipulates that the const keyword is equivalent before the type or variable name.
Const int n = 5; // same as below
Int const M = 10
Conclusion:
Char * const CP: defines a pointer constant pointing to a character, that is, the const pointer.
Const char * P: defines a pointer to a character constant.
Char const * P: equivalent to const char * P
Const char ** is a pointer to a pointer that points to another String constant.
Char ** is also a pointer to a pointer, which points to another string variable.