#include <stdio.h>
int main(){
int arr[10];
arr[0] =21474836;
printf("Adress was indicated as &arr is %p\n\n",&arr);
printf("Adress was indicated as arr is %p\n\n",arr);
printf("Adress was indicated as &arr[0] is %p\n\n",&arr[0]);
printf("Value of first element of integer array which is arr[0] is %d\n",arr[0]);
return 0;
}
当我编译这段代码时,我遇到了;
Adress was indicated as &arr is 0x7ffeabd200b0
Adress was indicated as arr is 0x7ffeabd200b0
Adress was indicated as &arr[0] is 0x7ffeabd200b0
Value of first element of integer array which is arr[0] is 21474836
作为输出。
我没有期望的输出,因为我使用了地址运算符;
arr --> it should refer adress of first element ;
&arr --> it should refer adress of adress of first element ;
最后,
为什么arr和&arr指的是同一件事?