This commit is contained in:
Bohdan Kapliuk 2024-04-25 23:19:51 +03:00
parent ba796e0c40
commit 10a84b9550

View File

@ -12,7 +12,7 @@ int main() {
prihlasky = (char **)malloc(max * sizeof(char *));
if (scanf("%d", &max) != 1 || max <= 0) {
puts("Nespravny vstup");
return 1;
return 0;
}
fgets(name, 50, stdin);
while (fgets(name, 50, stdin) && name[0] != '\n') {
@ -26,6 +26,10 @@ int main() {
counter++;
}
}
if(counter == 0){
puts("Ziadne prihlasky");
return 0;
}
qsort(prihlasky, counter, sizeof(char *), compare);
puts("Prijati studenti:");
for (int i = 0; i < max && i < counter; i++) {