From 131968a4881275ecb067400769b770d9a486f95b Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 25 Apr 2024 19:44:24 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index 6e7c5a1..d6ec6ee 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -24,8 +24,8 @@ int main() { } i = 0; - while (fgets(buffer, sizeof(buffer), stdin)) { - if (buffer[0] == '\n' || i >= count) { // End of input or reached maximum count + while (i < count && fgets(buffer, sizeof(buffer), stdin)) { + if (buffer[0] == '\n') { // End of input line break; } int len = strlen(buffer);