编辑代码

#include <stdio.h>

struct student {
  long student_id;
  char gender;
  int birth_year;
  int score_1;
  int score_2;
  int score_3;
};

void CorrectBirthYear(struct student* ptr,
                      double* ptr_average);

void main(void) {
    struct student stu1 = {11001101, 'F', 1900, 92, 81, 72};
    struct student* ptr;
    ptr = &stu1;
    double average;
    double* ptr_average = &average;
    CorrectBirthYear(&stu1, &average);
    printf("the average is %f.\n", *ptr_average);
    printf("the right is %d.", stu1.birth_year);
    return;
}

void CorrectBirthYear(struct student* ptr,
                      double* ptr_average){
    
    
    if ((*ptr).birth_year = 1900){
        (*ptr).birth_year = 2000;
    }
    *ptr_average = (((*ptr).score_1)+((*ptr).score_2)+((*ptr).score_3)) / 3.0;//记得是3.0!!!!
    
}