Initialization
This commit is contained in:
parent
ed42221d74
commit
52ce942162
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user