一直提示 error C2059: 语法错误 : “类型” ,求解哪里出现错误 谢谢
#include<stdio.h>#include<stdlib.h>
struct Student{
char name[20];
int num;
float score;
};
struct Student max(struct Student stu[])
{
int i,m=0;
for(i=0;i<5;i++)
if(stu[i].score>stu[m].score) m=i;
return stu[m];
}
int main()
{
struct Student stu[5]={{"Zhang",10101,85.3},{"Lin",10102,98.5},{"Sun",10103,86},{"Wang",
10104,68},{"Li",10105,70}};//初始化方式!
struct Student *p=stu;
struct Student temp;
int i;
int j;
for(i=0;i<5;i++)
printf("%s,%d,%0.2f\n",stu[i].name,stu[i].num,stu[i].score);
puts("Sort:\n");
for(i=0;i<5-1;i++)
for(j=i+1;j<5;j++)
if(stu[i].score>stu[j].score)
{temp=stu[i];stu[i]=stu[j];stu[j]=temp;}
for(;p<stu+5;)
{
printf("%s,%d,%0.2f\n",p->name,p->num,p->score);p++;
}
puts("The max is:\n");
temp=max(stu);
printf("%s,%d,%0.2f\n",temp.name,temp.num;temp.score);
system("pause");
return 0;
}