I am trying to insert data to the end of the list, but it's not working: an exception occurs at runtime.
struct gradeNode *newNode = (struct gradeNode*)malloc(sizeof(struct gradeNode));
assert(newNode != NULL);
strcpy(newNode->courseName, courseName); // copying the course name
newNode->next = NULL;
struct gradeNode *temp = students[i].gradelist->head; // a temp
// here is the problem: the debugger says ecxeption, can't access memory
while (temp->next != NULL)
{
temp = temp->next; // I can't get to here
temp->next = newNode;
}