修改後的數組的編譯器顯示:我試圖使二維數組,把它傳遞給函數,然後更新主
Warning: passing argument 1 of 'fun' from incompatible
pointer type; note: expected 'int()[5]' but argument
is of type 'int (*)[5][5]'
代碼:
#include<stdio.h>
void fun(int * b[][5])
{
int x=11,y=90;
printf("here");
*b[1][3] = x;
*b[3][1] = y;
*b[2][2] = x + ++y;
}
int main()
{
int a[5][5];
a[1][3] = 12;
a[3][1] = 145;
fun(&a);
printf("%d %d %d",a[1][3],a[3][1],a[2][2]);
}
將有助於... –
也會有所幫助,如果你包括一個實際的問題。 –