This commit is contained in:
2024-10-22 21:49:04 -07:00
parent a7d959538a
commit e0f6ba1702

8
Q2.c
View File

@@ -54,9 +54,13 @@ int main() {
printf("Average Grade: %0.02f\n", student_average_grade(arr[0]));
printf("Average Grade: %0.02f\n", student_average_grade(arr[1]));
printf("Average Grade: %0.02f\n", student_average_grade(arr[2]));
printf("Average Grade: %0.02f", all_student_averages(arr, 3));
printf("Average Grade: %0.02f\n", all_student_averages(arr, sizeof(arr) / sizeof(arr[0])));
//("Student with highest grades: ")
// It is impossible to print the name of the student with the highest total marks,
// Because it is a union, and if the student has marks, they cannot have the name member also populated
// Therefore, this will print nonsense for the name of the student with highest grades
Student highest = highest_grade(arr, sizeof(arr) / sizeof(arr[0]));
printf("Student with highest grades: %s", highest.name);
return 0;
}