Initialization

This commit is contained in:
Kozar 2024-04-22 19:16:28 +02:00
parent d9f4958390
commit 37b488a493

View File

@ -40,16 +40,20 @@ int main() {
num_students++; 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) { if (num_accepted == 0) {
printf("Ziadne prihlasky"); printf("Ziadne prihlasky");
} else { } else {
qsort(names, num_accepted, sizeof(names[0]), compare);
printf("Prijati studenti:\n"); printf("Prijati studenti:\n");
for (int i = 0; i < num_accepted; i++) { for (int i = 0; i < num_accepted; i++) {
printf("%s", names[i]); printf("%s", names[i]);
} }
} }
// if (num_accepted < num_students) { // if (num_accepted < num_students) {
// printf("Neprijati studenti:"); // printf("Neprijati studenti:");
// for (int i = 0; i < max_students; i++) { // for (int i = 0; i < max_students; i++) {