1 include <stdio.h>
2 int main()
3 {
4 int a=3;
5 int b=2;
6 int array[3];
7 array[0]=1;
8 array[1]=10;
9 array[2]=100;
10 int *p=&a;
11 int i;
12 for(i=0;i<6;i++){
13 printf("*p=%d\n",*p);
14 p++;
15 }
16 printf("-------------------------------------\n");
17 p=&a;
18 for(i=0;i<6;i++){
19 printf("p[%d]=%d\n",i,p[i]);
20 }
21 }
22
=====以下为输出======
*p=3
*p=1
*p=2
*p=-707193848
*p=32765
*p=1
-------------------------------------
p[0]=3
p[1]=1
p[2]=2
p[3]=-707193860
p[4]=32765
p[5]=1
-------------------