diff --git a/Startcode/input.c b/Startcode/input.c index ce0bd00..1617eb8 100644 --- a/Startcode/input.c +++ b/Startcode/input.c @@ -11,9 +11,10 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) unsigned int wordCount = 0; - while(fgets(words[wordCount],MAX_WORD_LEN,file) != NULL){ + while(fgets(words[wordCount],MAX_WORD_LEN,file) != NULL && wordCount+1 < maxWordCount){ wordCount++; } + return wordCount; } \ No newline at end of file