Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Print the min, average, max GPAs in the linked list /* * Function: NewStudentCell * Usage: student_cell_T *element; * element = NewStudentCell(int id, double gpa,
Print the min, average, max GPAs in the linked list
/* * Function: NewStudentCell * Usage: student_cell_T *element; * element = NewStudentCell(int id, double gpa, char *name); * -------------------------- * This function allocates space for a student cell and intilize its fileds */ student_cell_T *NewStudentCell(int id, double gpa, char *name) { student_cell_T *element; element = (student_cell_T *) malloc( sizeof(student_cell_T) ); if( !element){ fprintf(stderr,"NewStudentCell cannot allocate memory "); return NULL; } element->id = id; element->gpa = gpa; element->name = name; return element; }
/* * Type: student_cell_T * ----------- * This type defines the cells used for the linked list that * stores the student information we use in assing0 * You can change this structure later on for other assignments! */ typedef struct student_cell_T { int id; double gpa; char *name; // name is just a pointer here, you need to allocate space for name struct student_cell_T *next; } student_cell_T;
/* * Type: linked_list_T * -------------- * This type defines the concrete representation of a linked list of student cells. * The head field points to the first element in the linked list. * The tail field points to the last element in the linked list. * The empty linked list is indicated by a NULL head pointer. */ typedef struct linked_list_T { student_cell_T *head; student_cell_T *tail; } linked_list_T;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started