From 37b488a4933368717ec37fba8ce3f2618f84423c Mon Sep 17 00:00:00 2001 From: ak643du Date: Mon, 22 Apr 2024 19:16:28 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index 59ce60b..c18af4a 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -40,16 +40,20 @@ int main() { num_students++; } + // Add a null character at the end of the names array + names[num_accepted][0] = '\0'; + + qsort(names, num_accepted, sizeof(names[0]), compare); + if (num_accepted == 0) { printf("Ziadne prihlasky"); } else { - qsort(names, num_accepted, sizeof(names[0]), compare); printf("Prijati studenti:\n"); for (int i = 0; i < num_accepted; i++) { printf("%s", names[i]); } } - + // if (num_accepted < num_students) { // printf("Neprijati studenti:"); // for (int i = 0; i < max_students; i++) {