判断哪个被const了的标志是const在*的前面还是后面
1、所指是const
表示不能通过这个指针去修改那个变量(并不能使得那个变量成为const)
int i=3,j=6;
const int*p=&i; //non-const pointer,const data
*p=26;//ERROR!(*p) 是const
i=26;//OK
p=&j; //OK
2、指针是const
表示一旦得到了某个变量的地址,不能再指向其他变量
int i=3,j=6;
int* const q=&i; // //const pointer,non- data
*q=26;//OK
q++;//ERROR
3、通过两个const使得所指和指针都是const
表示一旦得到了某个变量的地址,该指针不能指向其他变量,也不能通过指针去修改那个变量
int i=3,j=6;
const int* const p=&i; //const pointer,const data