1.常量指针
比如:
int a=10;
const int *p=&a;
特点:常量指针,指针指向的值不能改变,但是指针的指向可以改变
2.指针常量
int a=10;
int * const p=&a;
特点:指针指向不能改变,但是指针指向的值可以改变
3.上面两种的综合
int a=10;
const int * const p=&a;
特点:指针指向和指针指向的值都不能改变
1.常量指针
比如:
int a=10;
const int *p=&a;
特点:常量指针,指针指向的值不能改变,但是指针的指向可以改变
2.指针常量
int a=10;
int * const p=&a;
特点:指针指向不能改变,但是指针指向的值可以改变
3.上面两种的综合
int a=10;
const int * const p=&a;
特点:指针指向和指针指向的值都不能改变