Initialization

This commit is contained in:
Kozar 2024-04-22 14:11:09 +02:00
parent bae377a353
commit 3b4e295c1e

View File

@ -15,7 +15,12 @@ int main() {
return 1; return 1;
} }
while (scanf(" %s", temp_name)!= EOF && num_accepted < max_students) { while (fgets(temp_name, sizeof(temp_name), stdin) != NULL && num_accepted < max_students) {
size_t len = strlen(temp_name);
if (len > 0 && temp_name[len-1] == '\n') {
temp_name[len-1] = '\0';
}
int i, found = 0; int i, found = 0;
for (i = 0; i < num_accepted; i++) { for (i = 0; i < num_accepted; i++) {