解答:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student {
int id;
char name[10];
int score1;
int score2;
int score3;
};
void input(student* student_array) {
for(int i=0; i<=4; i++) {
scanf("%d %s %d %d %d", &(*(student_array+i)).id, (*(student_array+i)).name, &(*(student_array+i)).score1, &(*(student_array+i)).score2, &(*(student_array+i)).score3);
}
}
void output(student* student_array) {
for(int i=0; i<=4; i++) {
printf("%d %s %d %d %d\n", (*(student_array+i)).id, (*(student_array+i)).name, (*(student_array+i)).score1, (*(student_array+i)).score2, (*(student_array+i)).score3);
}
}
int main() {
student* student_array = (student*)malloc(sizeof(student)*5);
input(student_array);
output(student_array);
return 0;
}