Initialization

This commit is contained in:
Kozar 2024-04-25 18:05:26 +02:00
parent 77eea37bb6
commit 2d6971997a

View File

@ -18,6 +18,7 @@ int main() {
memset(names, 0, sizeof(names));
while (fgets(temp_name, sizeof(temp_name), stdin)!= NULL && num_accepted < max_students) {
temp_name[strcspn(temp_name, "\n")] = '\0';
int i, found = 0;
@ -40,12 +41,13 @@ int main() {
} else {
printf("Prijati studenti:");
for (int i = 0; i < num_accepted; i++) {
printf("%s", names[i]);
printf("%s\n", names[i]);
}
if (num_students > num_accepted) {
printf("Neprijati studenti:");
for (int i = 0; i < num_students; i++) {
strcpy(temp_name, names[i]);
int found = 0;
for (int j = 0; j < num_accepted; j++) {
if (strcmp(names[j], temp_name) == 0) {
@ -54,7 +56,7 @@ int main() {
}
}
if (!found) {
printf("%s", temp_name);
printf("%s\n", temp_name);
}
}
}