Debugging a linked-list

I’ve debugged this for you. Fixes:

  1. In list_insertn, replace the entire if statement after the "If we exceed list length append at the end" comment with:

    if(list == NULL){
        return list_insert_tail(list, input);
    }
    
  2. 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){
    
  3. 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 various printf format strings that need them.

Browse More Popular Posts

Leave a Comment