#include <stdio.h>
void func(int b[][3]);
void func(int b[][3])
{
printf("%d\n", b[2][2]);
}
int main(void)
{
int a[3][4] = {
{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12}
};
func(a);
return 0;
}
C语言是按行读取的,因此b数组读进来的应该是:1、2、3、4、5、6、7、8、9、10、11、12,b[][3]表示每行有三个数,数组编号是从0开始的,因此b[2][2]表示第三行第三个数,也就是总第九个数,因此是9
你确定能输出而不是报错?你什么编译器可以将“int [3][4]”转换为“int [][3]”
应该是把传进来的数组当成了列数为3的数组