高手请给改个错

来源:百度知道 编辑:UC知道 时间:2024/05/26 05:53:26
用c语言编译
有两个错都指向max函数,说声明语法错误
请高手帮个忙
#include <stdlib.h>
#include<stdio.h>
#define N 4
struct stu
{
char name;
long number;
float grade[5];
}
void main()
{
void input(struct stu student[],int n);
void max(struct stu student[],int n);
/* void min(struct stu students[],int n);
void average(struct stu students[],int n); */
struct stu stud[3];
input (stud,N);
max (stud,N);
/* min (stud);
average (stud); */
}
void input(struct stu student[],int n)
{
int i,j;
char temp[30];
for(i=0;i<3;i++)
{
printf("\n please input name number English chiese math phy");
scanf(student[i].name);
get(temp);
student[i].number=atoi(temp);
for(j=0;j<3;i++)
{
gets(temp);
student[i].grade[j]=atoi(temp);
}
}
}
void max(struct stu

错误多得吐血。
1.结构体声明咋没分好结尾?
2.get是啥玩意?
3.没见过要求输入这么牛的:scanf(student[i].name);
4.char name就可以储存一个名字?用char *name吧。或者用char name[多少],到时候用strcpy把const char*复制到该数组中。
5.改好了再发吧。。。

if(student[i].grade[4]<student[i+1].grade[4])
(
temp=student[i];
student[i]=student[i+1];
student[i+1]=temp;
)

应该是{}
其他的,把错误贴出来,不然怎么看?

另外在main中声明函数,这个用法我还是第一次见到,不过应该没问题的
还是放到main前面把