编辑代码

#include <stdio.h>

struct Student {
    int id;
    int math;
    int chinese;
    int english;
};

float avgScore(struct Student *st){
    return ((st->math + st->chinese + st->english)/3.0);
}

int main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
    struct Student stu1 = {1,50,60,70};
    struct Student stu2 = {2,90,90,70};
    struct student *p1 = &stu1;
    struct student *p2 = &stu2;
    printf("1平均分:%f",avgScore(p2));
    return 0;
}