Question: 4. (10 marks) Write a C program that stores the grades of a class of students. You do not know the size of the class

4. (10 marks) Write a C program that stores the grades of a class of students. You do not know the size of the class in advance. Read the size of the class from the user, and then print the average grade of the class. Assume that it is the policy of this university to have students who have scored less than average drop the class. Write code that frees unneeded memory when the size of the class shrinks. Make sure that all values above average still remain in allocated memory after you shrink the size of the array. You may assume that realloc works by shrinking from the bottom of the array. You may also solve this problem by allocating another array, but for only eight points
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
