From 87f8055ada48a1aa4374f47096bc17210ce135fd Mon Sep 17 00:00:00 2001 From: ak643du Date: Mon, 22 Apr 2024 14:19:51 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index 3081a9f..2f641a3 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -15,13 +15,12 @@ int main() { return 1; } - // Initialize the names array to all-zero strings memset(names, 0, sizeof(names)); while (fgets(temp_name, sizeof(temp_name), stdin) != NULL && num_accepted < max_students) { size_t len = strlen(temp_name); if (len > 0 && temp_name[len-1] == '\n') { - temp_name[len-1] = '\0'; // remove newline character + temp_name[len-1] = '\0'; } int i, found = 0; @@ -44,7 +43,7 @@ int main() { } else { printf("Prijati studenti:\n"); for (int i = 0; i < num_accepted; i++) { - printf("%s\n", names[i]); + printf("%s", names[i]); } }