1、问题
比如二位数组名赋值给一个指针,指针在递增,超过这个行的最后一列后会得到怎么样结果。
2、代码举例
#include <stdio.h>int main()
{int a[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};int *p = NULL;p = &a[1][1];printf("first value is %d\n", *p);printf("second value is %d\n", *++p);printf("third value is %d\n", *++p);return 0;
}
3、运行结果
1111deMacBook-Pro:dabian a1111$ vim more_array.c
1111deMacBook-Pro:dabian a1111$ gcc -g more_array.c -o more_array
1111deMacBook-Pro:dabian a1111$ ./more_array
first value is 5
second value is 6
third value is 7