首先,我们需要看一张图:
我们可以看到,这一个 3*2 的二维数组,在第三行第一列的位置上存储着数字 5 ,如果我给一个函数输入这个二维数组作为参数,应该怎么做呢?
#include <stdio.h>
void print(int test[][2]);
int main(int argc, char *argv[])
{
int test_array[3][2] = {1, 2, 3, 4, 5, 6};
print(test_array);
return 0;
}
void print(int test[][2])
{
printf("test[2][1] = %d\n", test[2][0]);
}
上