【求助】'int [4][4]' differs in levels of indirection from 'int '
#include<stdio.h>void main()
{int a[4][4],m,n,sum=0;
int ac(int a[4][4]);
int sum1(int a[4][4]);
printf("请输入一个4*4矩阵\n");
for(m=0;m<4;m++)
{for(n=0;n<4;n++)
scanf("%d", &a[m][n]);
}
a=ac(a);
for(m=0;m<4;m++)
{for(n=0;n<4;n++)
printf("%d\t", a[m][n]);
printf("\n");}
sum=sum1(a);
printf("%d",sum);
}
int ac(int a[4][4])
{int i;
while(i<4)
{a[i][i]=1;
a[i][4-i]=1;}
return a;
}
int sum1(int a[4][4])
{int sum=0,m,n;
for(m=0;m<4;m++)
{for(n=0;n<4;n++)
sum+=a[m][n];
}
sum-=8;
return sum;
}
Compiling...
Text1.c
C:\Users\Administrator\Desktop\Text1.c(11) : warning C4047: '=' : 'int [4][4]' differs in levels of indirection from 'int '
C:\Users\Administrator\Desktop\Text1.c(11) : error C2106: '=' : left operand must be l-value
C:\Users\Administrator\Desktop\Text1.c(29) : warning C4047: 'return' : 'int ' differs in levels of indirection from 'int (*)[4]'
执行 cl.exe 时出错.
Text1.obj - 1 error(s), 0 warning(s)