[c]代码库
#include <stdio.h>
int main() {
int i, j;
int *p, *q;
int a[3][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
int b[3][4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
for (i = 0; i < 3; i++) {
for (j = 0; j < 4; j++)
printf("%-4d", a[i][j]);
printf("\n");
}
printf("\n");
for (i = 0; i < 3; i++) {
for (j = 0; j < 4; j++)
printf("%-4d", b[i][j]);
printf("\n");
}
printf("\n");
p = &a[0][0];
for (i = 0; i < 12; i++)
printf("%-4d", p[i]);
printf("\n");
q = &a[0][0];
for (i = 0; i < 12; i++)
printf("%-4d", q[i]);
}