I’ve debugged this for you. Fixes:
-
In
list_insertn
, replace the entireif
statement after the"If we exceed list length append at the end"
comment with:if(list == NULL){ return list_insert_tail(list, input); }
-
In
list_remove
, replace the test after the"We check to see if they have the same data"
comment with:if(strcmp(list->data, input) == 0){
-
As general clean-up, fix all of the
\\n
instances to be just\n
, and also add any missing\n
characters to the end of your variousprintf
format strings that need them.