为什么我可以访问带有两个参数的指针数组,当它被定义为一维时?
我知道,我必须使用指针数组来访问函数中的多维数组,但我不知道为什么我可以使用两个参数访问指针数组。
int a[m][l] { 1,2,3,4, 2,3,4,5, 3,4,5,6 }; //some matrices
int c[m][l];
int *ap[m]; //array of pointers one-dimensional
int i,j;
for (i = 0; i < m; i++) //passing the address of first element in each
ap[i] = a[i]; //colon of matrix to array of pointers
for (j = 0; j < m; j++)
bp[i] = b[i];
dosomethingwithmatrix(ap[0], bp[0], m, l);
int* dosomethingwithmatrix(const int*ap[], int* bp[])
{
cp[i][j] = ap[i][j] //accss the array of pointers with two parameters
}