From 0c6b56eb391c80af8941e9f2fa6980f0ff0020cd Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 25 Apr 2024 20:31:08 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index de71e14..f842e78 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -29,17 +29,8 @@ int main() { if (len > 0 && buffer[len - 1] == '\n') { // Remove newline character if present buffer[len - 1] = '\0'; } - int found = 0; - for (j = 0; j < i; j++) { - if (strcmp(applications[j], buffer) == 0) { - found = 1; - break; - } - } - if (!found) { - applications[i] = strdup(buffer); - i++; - } + applications[i] = strdup(buffer); + i++; } if (i == 0) { @@ -50,13 +41,13 @@ int main() { // Sort the applications alphabetically qsort(applications, i, sizeof(char *), compare_names); - printf("Prijati studenti:"); + printf("Prijati studenti:\n"); for (j = 0; j < i; j++) { printf("%s\n", applications[j]); } if (count < i) { - printf("Neprijati studenti:"); + printf("Neprijati studenti:\n"); for (; j < i; j++) { printf("%s\n", applications[j]); }