指针常量
指针本身是常量
指针 ( p ) 地址不能改变,指针指向的变量(*p)可以修改
const用来修饰指针,所以指针的地址不能改变
int * const p ;
*p = 3;
常量指针
被指向的对象是常量
是一个常量,但是指针的地址可以改变.
const修饰指针(d)所指向的常量(*d),所以指针指向的
常量(*d)不能改变,但是指针的地址(d)可以修改
int const *d ;
int c = 0;
d = &c;
//同上
const int *e ;
e = &c;