correctly allocate string array

This commit is contained in:
SowinskiBraeden committed 2024-10-15 08:52:59 -07:00
1 parent 113958abb2
commit 681d5daa47
1 file changed
+1 -1
+1 -1
View File
@@ -75,7 +75,7 @@ TIMETABLE generateTimetable(STUDENT *students, size_t size_students, COURSE *cou
/*** STEP 1 - Tally requests to check which courses are eligable to run ***/ /*** STEP 1 - Tally requests to check which courses are eligable to run ***/
char **activeCourses = malloc(MAX_CLASSES * sizeof(char*)); char **activeCourses = malloc(MAX_CLASSES * sizeof(char *));
uint16_t *activeCoursesIndexes = malloc(MAX_CLASSES * sizeof(uint16_t)); uint16_t *activeCoursesIndexes = malloc(MAX_CLASSES * sizeof(uint16_t));
uint16_t activeCoursesLen = 0; // also acts as the length of activeCourses uint16_t activeCoursesLen = 0; // also acts as the length of activeCourses
for (size_t i = 0; i < size_students; i++) { for (size_t i = 0; i < size_students; i++) {