I get this problem where I am copying words into a list as words are entered. Essentially everytime a word is entered, I create a node and link that into the list.
At the end, I print out the list, but for some reason I only get the last word that I entered printing, several times.
My head and tail are globalsCode:list print () { list current = head; while(current != NULL) { printf("%s\n", current->string); current = current->next; } return (head); } void list (char *input) { list node; node = makeN(); if(head == NULL) { head = node; tail =node; head->string= input; tail->string = input; } else { tail->next = node; tail = tail->next; tail->word = input; } }