C语言编写的程序,编译没有错误,运行输入后就停止了

#include <stdio.h>
#define N 2
struct
{
long num;
char name;
int score[4];
float aver;
int total;

}stu[N];

int max()
{struct stu;
int i,m;
for(i=0;i<N-1;i++)
{
if(stu[i].total<stu[i+1].total)
m=i+1;
}
return(m);
}

void insort()
{ struct stu;
int j,i;
float tave,zong;

printf("please %d students's information:\n",N);

for(j=0;j<N;j++)
{scanf("%ld%s%d%d%d%d",&stu[j].num,stu[j].name,&stu[j].score[0],&stu[j].score[1],&stu[j].score[2],&stu[j].score[3]);
stu[j].total=stu[j].score[0]+stu[j].score[1]+stu[j].score[2]+stu[j].score[3];
stu[j].aver=stu[j].total/4;
}
for(i=0;i<N;i++)
zong+=stu[i].aver;
tave=zong/N;

}
int main()
{int i,m,s;
float tave;
struct stu;
insort();

for(i=0;i<N;i++)
{
printf("%ld\t%s\t%d\t%d\t%d\t%d\t%f\t%d\n",stu[i].num,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].score[3],stu[i].aver,stu[i].total);
}
printf("after sort the highest studenst's scores is:\n");
s=max(m);
printf("%ld\t%s\t%d\t%d\t%d\t%d\t%f\t%d\n",stu[s].num,stu[s].name,stu[s].score[0],stu[s].score[1],stu[s].score[2],stu[s].score[3],stu[s].aver,stu[s].total);
printf("the total average is %f \n",tave);
return(0);
}

scanf("%ld%s%d%d%d%d",&stu[j].num,stu[j].name,&stu[j].score[0],&stu[j].score[1],&stu[j].score[2],&stu[j].score[3]); 这句有个%s
按个回车试试?多按几个
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-11-30
zong都未初始化追问

麻烦问一下具体怎么初始化啊

相似回答