From bb0777b8087514d6d7a9661baa375c99782ebd23 Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 25 Apr 2024 21:13:11 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index e3e5a26..e7b1e9e 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -51,14 +51,15 @@ int main() { // Sort the applications alphabetically qsort(applications, accepted_count, sizeof(char *), compare_names); - printf("Prijati studenti:"); - for (j = 0; j < accepted_count; j++) { + printf("Prijati studenti:\n"); + for (j = 0; j < count && j < accepted_count; j++) { printf("%s\n", applications[j]); } - if (count < accepted_count) { - printf("Neprijati studenti:"); - for (; j < i; j++) { + + if (count > accepted_count) { + printf("Neprijati studenti:\n"); + for (j = accepted_count; j < i; j++) { printf("%s\n", applications[j]); } } @@ -70,4 +71,4 @@ int main() { free(applications); return 0; -} \ No newline at end of file +}