Well its in a function. It's not actually head.
But this is the bulk of my main function:
Code:
while(fgets(line, MAX_LINE, input))
{
fname = strtok(line, ",");
if(!fname) continue;
lname = strtok(NULL , ",");
if(!lname) continue;
IDstring = strtok(NULL , ",");
ID = atoi(IDstring);
stuPtr = createStudent(ID, fname, lname);
}
printList(stuPtr);
ptr = stuPtr;
stuPtr = insert(stuPtr, 19923, "Andrew", "Durington");
printf("=========================\n");
printList(stuPtr);
return 0;
}
//Create Student Function
Student* createStudent(int ID, char *fname, char *lname)
{
Student *newStu = malloc(sizeof(Student));
if((newStu == NULL))
{
printf("Error: Could not allocate memory\n");
return NULL;
}
newStu->ID = ID;
strcpy(newStu->fname, fname);
strcpy(newStu->lname, lname);
newStu->next = NULL;
return newStu;
}
And my print function is listed in the first post