Hi folks, I have another little problem.
I've been working on a program that's supposed to compare two text files (of lists of words) and see if they have all the same words (regardless of what order they're in).
What I've done is turned one of the lists into a linked list and then read in one word of the other file and go through the linked list and delete that word. Since I know the files have the same words I should get an empty linked list back.
But there is a problem with this part of my code.
Oh and it's in a while loop which is scanning in each word of the other file.
It compiles but it as soon as the program is done printing j, I get an error. I can't really spot wht the error is. All I know is that it isn't really working.Code:/*comparing scanned in word to current->word while searching down linked list*/ for(current=current->next; current!=NULL; current=current->next){ printf("%d ", j); /*j is just for me to check if the loop here works. It does.*/ j++; if(strcmp(current->data, word)==0){ deletenode(current, current->data); } }



LinkBack URL
About LinkBacks


