Code:Here are the program details: 1. Modify the grading program from project 12 such that: 1) The program uses the same grading policy. The program will read in the students’ scores. 2) The program should be built around a linked list of structures instead of an array of structures. The structure will contain an additional member (a pointer to the next node). Store a student’s information in a dynamically allocated structure. 3) There should not be a limit on the size of the database. Use malloc to allocate memory for a new structure. 4) Before the program terminates, print a listing of all students in the database, showing their names, scores on quizzes and tests, and their numeric score for the entire course. Name Quiz1 Quiz2 midterm Final Total Mike Fisher 8 9 89 98 92.5 Jon Stewart 7 8 78 84 80.5 … 5) Before the program terminates, display the average of the quizzes, tests, and the total score. Quiz1 Quiz2 midterm Final Total Average 7.5 8.5 83.5 91 86.375 … For some odd reason, a segmentation error is popping up as soon as I say n (for no). Also, I would like to be able to display the previous names and grades that I put in the loop. I am not sure how to. Any help ASAP would be appreciated. Thank you. #include <stdio.h> #include <stdlib.h> #include <ctype.h> #define NAME_LEN 50 int read_line(char str[], int n); void insert (int num_students); void average_finder(int num_students); void print (int num_students); struct test_result { char name[NAME_LEN+1]; int number; int grade1; int grade2; int midterm; int final; float numeric; struct test_result *next; }; struct test_result *studen = NULL; int main(void) { struct test_result *p; char code = 'y'; int num_students = 0; int done = 0; while(!done) { switch (code) { case 'y': insert(num_students); print(num_students); break; case 'n': average_finder(num_students); done++; return 0; default: printf("Invalid entry. Try again.\n"); return 0; } printf("\nWould you like to enter another record? y(yes) or n(no)?"); scanf(" %c", &code); while (getchar() != '\n'); /* skips to end of line */ } return 0; } void insert(int num_students) { //int part_number = 0; struct test_result *p; p = malloc(sizeof(struct test_result)); printf("Enter the student name: "); read_line(p->name, NAME_LEN); printf("Enter the student's grade for quiz #1: "); scanf("%d", &p->grade1); printf("Enter the student's grade for quiz #2: "); scanf("%d", &p->grade2); printf("Enter the student's grade for midterm: "); scanf("%d", &p->midterm); printf("Enter the student's grade for final: "); scanf("%d", &p->final); p->numeric = (((p->grade1 + p->grade2) * 1.25) + (p->midterm * 0.25) + (p->final * 0.50)); } void average_finder(int num_students) { num_students = 0; struct test_result *p; int total_quiz1 = 0; int total_quiz2 = 0; int total_midterm = 0; int total_final = 0; int total_numeric = 0; float average_quiz1 = 0; float average_quiz2 = 0; float average_midterm = 0; float average_final = 0; float average_numeric = 0; total_quiz1 += p->grade1 += num_students; total_quiz2 += p->grade2 += num_students; total_midterm += p->midterm += num_students; total_final += p->final += num_students; total_numeric += p->numeric += num_students; average_quiz1 = (double)total_quiz1 / num_students; average_quiz2 = (double)total_quiz2 / num_students; average_midterm = (double)total_midterm / num_students; average_final = (double)total_final / num_students; average_numeric = (double)total_numeric / (num_students); printf(" Quiz1 Quiz2 Midterm Final Total\n"); printf("Average %9.1f %9.1f %9.1f %9.1f %9.3f\n", average_quiz1, average_quiz2, average_midterm, average_final, average_numeric); } void print(int num_students) { struct test_result *p; printf("Name Quiz1 Quiz2 Midterm Final Total\n"); printf("%10s %9d %9d %9d %9d %9.1f\n", p->name, p->grade1, p->grade2, p->midterm, p->final, p->numeric); } int read_line(char str[], int n) { int ch, i = 0; while(isspace(ch = getchar())) ; str[i++] = ch; while ((ch = getchar()) != '\n') { if (i < n) str[i++] = ch; } str[i] = '\0'; return i; }