/*Purpose:a system used for managing students' grades*/
/*Date:30/7/2010*/
# include<stdio.h>
main()
{
float grade[5][4];
int row=0,colum=0;
for(row=0;row<4;row++)
{
printf("please input NO.%d's grades(Math/C/Dbase):",row+1);
for(colum=0;;colum++)
if(colum<3)
scanf("%f",&grade[row][colum]);
else
break;
}
printf("All data have got in.\n");
return 0;
}
编译能够通过,在运行时等输入数据回车后,系统提示错误!而当我将其改为:
/*Purpose:a system used for managing students' grades*/
/*Date:30/7/2010*/
# include<stdio.h>
main()
{
float grade[5][4]={0}; //注意,我在这里给数组赋初值
int row=0,colum=0;
for(row=0;row<4;row++)
{
printf("please input NO.%d's grades(Math/C/Dbase):",row+1);
for(colum=0;;colum++)
if(colum<3)
scanf("%f",&grade[row][colum]);
else
break;
}
printf("All data have got in.\n");
return 0;
}
却又可以正常运行了,这是说明原因呢?谁能帮我解答一下,谢啦