void pointer(int *p) { int a = 11; printf("\nthe p is %p , addr is %p, *p is %d",p , &p, *p); *p =11; printf("\nthe p is %p , addr is %p, *p is %d",p , &p, *p); p = &a; printf("\nthe p is %p , addr is %p, *p is %d",p , &p, *p); } int main() { int b =22; int *p = &b; printf("the p is %p , addr is %p, *p is %d",p , &p, *p); pointer(p); printf("\nthe p is %p , addr is %p, *p is %d\n",p , &p, *p); }
运行结果:
the p is 00A0FEE4 , addr is 00A0FEDC, *p is 22
the p is 00A0FEE4 , addr is 00A0FEE0, *p is 22
the p is 00A0FEE4 , addr is 00A0FEE0, *p is 11
the p is 00A0FEE8 , addr is 00A0FEE0, *p is 11
the p is 00A0FEE4 , addr is 00A0FEDC, *p is 11
时间: 2024-10-13 12:09:49