ubuntu下测试
#include "stdio.h"
int main(void)
{
int a[2] = {0x123,0x234};
int *p;
p = a;
*(p + 1) = 0x789;
long long b;
b = *(long long*) p;
printf("addr a[0]:%p\n", &a);
printf("addr a[1]:%p\n", &a[1]);
printf("addr p:%p\n", p);
printf("addr b:%p\n", &b);
printf("b:%llx\n", b);
printf("size of b:%lu\n", sizeof(b));
return 0;
}
结果
addr a[0]:0x7ffe58d24090
addr a[1]:0x7ffe58d24094
addr p:0x7ffe58d24090
addr b:0x7ffe58d240a0
b:78900000123
size of b:8