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++) {