#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int intr[10]={20,30,40,50,60,70,80,90,100,110};
int *p = intr;
printf("the address intr = %X\n",intr);
printf("the address &intr = %X\n",&intr);
printf("the address intr+4 = %X\n",intr+4);
printf("the address &intr+4 = %X\n",&intr+4);
printf("the value intr[0] = %d\n",*p);
p = intr+4;
printf("the value intr+4==intr[4] = %d\n",*p);
p = &intr+4;
printf("the value &intr+4==intr[0]+4*10(数组长度)*4(元素类型宽度) = %d\n",*p); //输出的答案不确定,因为已经越界了
p = (&intr+4);
printf("the value &intr+4==intr[-31] = %d\n",p[-31]); //输出intr[9] 的值
system("PAUSE");
return 0;
}
/*
输出:
the address intr = 22FF40
the address &intr = 22FF40
the address intr+4 = 22FF50
the address &intr+4 = 22FFE0
the value intr[0] = 20
the value intr+4==intr[4] = 60
the value &intr+4==intr[0]+4*10(数组长度)*4(元素类型宽度) = -1
the value intr+9==intr[9] = 110
请按任意键继续. . .
*/