From 52ce942162332cdacc8a6843ce1010efbf6025ff Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 25 Apr 2024 20:15:45 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index 4c9be8a..5b28683 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -27,11 +27,7 @@ int main() { } // Načítanie prihlášok - while (num_applications < max_students && fgets(buffer, sizeof(buffer), stdin) != NULL && buffer[0] != '\n') { - size_t len = strlen(buffer); - if (buffer[len - 1] == '\n') { - buffer[len - 1] = '\0'; // odstránenie koncového znaku nového riadku - } + while (num_applications < max_students && scanf("%s", buffer) == 1) { applications[num_applications] = strdup(buffer); if (applications[num_applications] == NULL) { puts("Chyba alokacie pamate");