#include “stdio.h”
int main(){
int x = 20;
int y = 30;
int *z = &x;
const int *a = &x; //const pointer
int * const b = &x; //pointer const
//*a = y; //错误
printf(“the addr of a = %p, *a = %d\n”, a,*a);
a = &y;
printf(“the addr of a = %p, *a = %d\n”, a,*a);
printf(“the addr of b = %p, *b = %d\n”, b,*b);
*z = 200;
//b = &y; //错误
printf(“the addr of b = %p, *b = %d\n”, b,*b);
printf(“the addr of x = %p, x = %d\n”, &x,x);
return 0;
}
the addr of a = 0x7ffc60f625a0, *a = 20
the addr of a = 0x7ffc60f625e0, *a = 30
the addr of b = 0x7ffc60f625a0, *b = 20
the addr of b = 0x7ffc60f625a0, *b = 200
the addr of x = 0x7ffc60f625a0, x = 200