Question: Program 4 In Program4.c, we will consider the structure student from Program2.c. Modify the function sort() from Program3.c to sort an array of n students


Program 4 In Program4.c, we will consider the structure student from Program2.c. Modify the function sort() from Program3.c to sort an array of n students based on their initials. The function prototype is void sort(struct student* students, int n). In sort(), if two students have the same first initial, you should compare their second initial. As in Program2.c, initials and scores of students are to be generated randomly by rand(). Make sure that you can handle the case when the user provides input n=0. Grading of Program 4: maximum 40 points Sorts an array of student structures correctly = 40 points A penalty of negative 10 points if your code does not correctly address the case when two students have the same first initial. A penalty of negative 10 points if your code does not correctly address an empty array of students. Zero points if the code cannot be executed or gives "Segmentation fault". 1/* CS261- HW1 - Program4.c*/ 2/* Name: Michael Hwang * Date: 1/15/21 * Solution description: HW1 Program 4 5 */ 3 4 6 7 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
