Some people May is confused about the sequence of a const and * on declaration in c++/c, me too.
Now I think we can distinguish them by the this to:
1.only noticing the position of const to *, and we can find, the following statements is same:
Const int * foo_int; int Const * FOO_INT_; Same.
2.regarding const as a postpositive attributes, andYou'llknow the content whic H is Const.
intFoo =6;intFoo_ =7;//the Foo_int is const and the pointer to Foo_int can be chaged.int Const* Foo_int = &foo;//illegal, the value cannot be chaged//*foo_int = 7//okay!Foo_int = &Foo_;//the pointer to int are const, but Foo_int_ can be chaged.int*ConstFoo_int_ = &Foo_int;//illegal, the pointer cannot be changed.//foo_int = &foo_int_;//even if the new pointer is same, it ' s illegal//foo_int = &foo_int;//Okay*foo_int =8;
The difference between const int *, int * const, int const *