#include <stdio.h>
int main(){
int a = 5, b = 7, c = 9;
/*&a = 0x7fff50a61be8
&b = 0x7fff50a61be4
&c = 0x7fff50a61be0*/
printf("&a = %p\n&b = %p\n&c = %p\n",&a,&b,&c);
//一维指针数组 : 数组类型 *数组名[数组长度] = 数组 数组里面存放的是地址(指针)
int *p[3] = {&a,&b,&c};
//遍历指针数组的每个元素的地址
for(int i = 0; i < 3;i++){
printf("&p[%d] = %p\n",i,&p[i]);
/* &p[0] = 0x7fff5a5abbf0
&p[1] = 0x7fff5a5abbf8
&p[2] = 0x7fff5a5abc00*/ }
return 0;
}
里面的 变量 a,b,c,的地址 和指针数组里的元素&a,&b,&c的地址...为什么不一样呀..... |
|