C方法错误

can*_*ton 0 c incompatibletypeerror

我有以下代码:

#define MIDTERM_PERCENTAGE 40
#define FINAL_PERCENTAGE 60
#define ARRAY_LENGTH(array) (sizeof((array))/sizeof((array)[0]))

struct student 
{
     char name[20];
     int  midterm;
     int  final;
     int  grade;
}

int calcGrade(struct student s) {
    int midterm = (s.midterm * MIDTERM_PERCENTAGE)/100;
    int final = (s.final * FINAL_PERCENTAGE)/100;
    int grade = midterm + final;
    return grade;
}
Run Code Online (Sandbox Code Playgroud)

我收到这些错误:

student.c:13: two or more data types in declaration of `calcGrade'
student.c: In function `calcGrade':
student.c:17: incompatible types in return
Run Code Online (Sandbox Code Playgroud)

我也有一个头文件具有以下声明:

int calcGrade(struct student s);
Run Code Online (Sandbox Code Playgroud)

但是,我没有看到我的错误.我想也许这是我的部门的一个问题,但因为它没有给我设置grade = midterm + final的错误我不明白为什么我的返回类型有问题.

izo*_*ica 5

在结构定义结束后忘记了分号.