19 lines
458 B
C
19 lines
458 B
C
|
#include <stdio.h>
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
int arr[3][4] = {1, 2, 3, 4, 5, 6, 7, 8,
|
||
|
9, 10, 11, 12};
|
||
|
// arr 表示第 0 行的地址, arr[0] 表示第 0 行的地址
|
||
|
int *p = arr[0]; // p 表示第 1 行的地址
|
||
|
for (int j = 0; j < 3; j++)
|
||
|
{
|
||
|
for (int i = 0; i < 4; i++)
|
||
|
{
|
||
|
printf("%d ", *(p + i));
|
||
|
}
|
||
|
printf("\n");
|
||
|
p += sizeof(arr[0]) / sizeof(arr[0][0]);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|