syntax error?
main(){int s[M][M]={{23,87,10,44,11},
{91,66,24,5,51},
{31,2,19,91,28},
{65,40,9,6,39},
{22,35,49,82,76}};
.......
compile时,老是在{int s[M][M]={{23,87,10,44,11},这一行显示 syntax error before '{' token
看了半天了,没看出在{之前有什么问题呀?怎么回事?
完整程序是:
#include <stdio.h>
#include <stdlib.h>
#define M 5
void findmin(int a[][M], int ln[])
{int i,j,t;
for (i=0;i<M;i++)
{t=0;
for (j=1;j<M;j++)
if (a[j][i]<a[t][i]) t=j;
ln[i]=t;
}
void outdata(int (*a)[M],int *ln)
{int i,j;
printf("\nThe primary Matrix:\n");
for (i=0;i<M;i++)
{for(j=0;j<M;j++)
printf("%8d",a[i][j]);
printf("\n");
}
printf("\nmin & line number\n");
for (i=0;i<M;i++)
printf("3%d:2%d\n",a[ln[i]][j],ln[i]);
printf("\n");
}
main()
{int s[M][M]={{23,87,10,44,11},
{91,66,24,5,51},
{31,2,19,91,28},
{65,40,9,6,39},
{22,35,49,82,76}};
int lnm[M];
findmin(s,lnm);
outdata(s,lnm);
system("PAUSE");
return 0;
}