From afdd93f035776def1fdad55e4d411868c988bee3 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 26 Oct 2026 15:15:59 +0100 Subject: [PATCH] input Versuch 2 --- Startcode/input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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