二维数组的指针遍历
#include<stdio.h> int main() { int i; int j; int a[3][4] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; int(*p)[4]; p = a; for (i = 0; i < 3; i++) { for (j = 0; j < 4; j++) { printf("%3d", *(*(p+i)+j)); } } while (1); return 0; }
#学习路径#
#include<stdio.h> int main() { int i; int j; int a[3][4] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; int(*p)[4]; p = a; for (i = 0; i < 3; i++) { for (j = 0; j < 4; j++) { printf("%3d", *(*(p+i)+j)); } } while (1); return 0; }
相关推荐