#include<stdio.h>
int main(int argc, const char *argv[])
{
int a[3][4]={ {0,1,2,3},
{4,5,6,7},
{8,9,10,11},
};
for(int i=0;i<3;i++){
for(int j=0;j<4;j++){
printf("%p ",&a[i][j]);
}
putchar(10);
}
printf("a=%p \n",a);
printf("a[1]=%p\n",a[1]);
printf("a[1]+1=%p\n",a[1]+1);
printf("a[2]=%p\n",a[2]);
printf("a+1=%p\n",a+1);
printf("a+2=%p\n",a+2);
printf("*(a+2)+1=%p\n",*(a+2)+1);
return 0;
}
$cc -std=c99 7.c
$./a.out
0xbf803a88 0xbf803a8c 0xbf803a90 0xbf803a94
0xbf803a98 0xbf803a9c 0xbf803aa0 0xbf803aa4
0xbf803aa8 0xbf803aac 0xbf803ab0 0xbf803ab4
a=0xbf803a88
a[1]=0xbf803a98
a[1]+1=0xbf803a9c //a[i]是列指针,+1操作后移动一列
a[2]=0xbf803aa8
a+1=0xbf803a98 //a+i是行指针,+1操作后移动一行
a+2=0xbf803aa8
*(a+2)+1=0xbf803aac //*将行指针降级成列指针