This is the loop in my a4.c main method that calls the patternsearch function:
while(!feof(stdin)) {
scanf("%s", &word);
patternSearch(grid, word);
}
For some reason that I can't figure out, this prints the last call to patternsearch twice:
For example, look at my output for test3:
Found "tip" at 0 2, L
Found "pop" at 0 0, D
Found "pop" at 2 0, U
Found "key" at 0 3, D
Found "key" at 2 1, R
"nope" - Not Found
"nope" - Not Found
As you can see, the test result for 'nope' was printed twice. :(
I think my problem is similar to the one stated here: Last line being printed twice (C++) but I'm not sure.