Initialization

This commit is contained in:
Kozar 2024-04-25 20:15:45 +02:00
parent ed42221d74
commit 52ce942162

View File

@ -27,11 +27,7 @@ int main() {
} }
// Načítanie prihlášok // Načítanie prihlášok
while (num_applications < max_students && fgets(buffer, sizeof(buffer), stdin) != NULL && buffer[0] != '\n') { while (num_applications < max_students && scanf("%s", buffer) == 1) {
size_t len = strlen(buffer);
if (buffer[len - 1] == '\n') {
buffer[len - 1] = '\0'; // odstránenie koncového znaku nového riadku
}
applications[num_applications] = strdup(buffer); applications[num_applications] = strdup(buffer);
if (applications[num_applications] == NULL) { if (applications[num_applications] == NULL) {
puts("Chyba alokacie pamate"); puts("Chyba alokacie pamate");