【发布时间】:2019-12-27 01:50:44
【问题描述】:
我遇到了一个指针变量的两个不同地址。我不知道它们是什么意思。为什么两个输出有两个不同的地址?
char *name = "John";
printf("is stored at %p\n",name ); //output that is showed "is stored at 0x558b8c21e9c4"
printf("print on the screen %p\n",&name);//output that is showed "print on the screen 0x7ffd8b9be710"
【问题讨论】:
-
第一个是指针持有的地址。第二个是指针本身的地址。