多维数组,本质上是数组的数组:
一、多维数组:
int B[2][3]
int(*P)[3] = B;
Print B //400
Print *B; //400
Print B[0] //400
Print &B[0][0] // 400
B[i][j] = *(B[i]+j) = *(*(B+i)+j);
int C[3][2][2]
int(*p)[2][2] = C;
Print C //800
Print *C or C[0] or &C[0][0] //800
Print *(C[0][1]+1) or C[0][1][1] //9
Print *(C[1]+1)or C[1][1] or &C[1][1][0] //824
int main()
{
int C[3][2][2] = { {{2,5},{7,9}},
{{3,4},{6,1}},
{{0,8},{11,13}}};
printf("%d %d %d %d\n", C, *C, C[0], &C[0][0]);
printf("%d\n", *(C[0][0] + 1));
}
二、函数接收一个三维数组的方式:
void Func(int(*A)[2][2])//不是写成(***A)的形式
{
}
int main()
{
int C[3][2][2] = { {{2,5},{7,9}},
{{3,4},{6,1}},
{{0,8},{11,13}}};
int A[2] = { 1,2 };
int B[2][3] = {{2,4,6,},{5,7,8}};
Func(C);
}