This assignment expands upon your previous assignment. In the previous homework, you may have noticed that only one students array can exist. Imagine a scenario in which you wanted to have two arrays of students. For example, a roster for CSI333 and CSI219. This requires two separate arrays of students.

To fix this problem, below introduces a new structure called Course. A course contains an array of students within it.

typedef struct student_struct
{
char name[16];
float gpa;
int age;
} Student;
typedef struct course_struct
{
char name[16];
Student students[100];
int size;
} Course;

Your task in this assignment is to expand the functions used in the previous homework to work with multiple student arrays (Courses). You will have to use pointers to get this to work correctly. Many of the function prototypes have been changed to use pass by pointer.

Implement the following four functions. Use the implementation from the previous homework as a starting point.

void push(Course *course, Student s);
int findStudent(Course course, char *name);
void insert(Course *course, Student s, int idx);
void destroy(Course *course, int idx);

Notice that the four functions now take a Course or Course Pointer parameter. The findStudent function does not use a Course pointer, since it is read-only and does not need to edit the course structure. The other functions require a course to be a pass-by-pointer, since they edit the course structure.

--- CSI219 Student Roster
Greg, 3.0, 18
Henry, 3.1, 19
Adam, 3.1, 21
Ian, 3.2, 20
Jane, 3.3, 21
--- CSI333 Student Roster
Beth, 3.0, 20
Chris, 2.9, 19
Daphney, 3.7, 20
Erin, 3.5, 18
Fred, 2.8, 19
Chris is located at index 1
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.