Eg: q (1) const char *P
(2) What is the difference between char * const P?
Method: The const is regarded as an adjective affix, that is, next to the nearest noun.
If there is * to note, * means a pointer to the type XX, the combination variable name is a noun.
Explain that the above affixes are (1) A pointer to a constant char type (the value pointed to by the pointer cannot be changed and the pointer can point to another value)
(2) A pointer to a char type, constant (the value that the pointer points to can be changed, and the pointer cannot point to another value)
Note the difference between char * const P and Char const * p,
Part-of-speech analysis: char nouns, * nouns, const adjectives, p nouns
char * const P is equivalent to char (* const p), const belongs to the affix of * p, that is, by adding a boundary line between *p, then P is unchanged, *p can be changed.
While Char const *P is relative to (char const) (*p), const belongs to char, then P is changed, and *p is unchanged.
"C + +" Judging the effect of the different positions of const affixes