Initialization

This commit is contained in:
Kozar 2024-04-25 17:47:40 +02:00
parent 9fdb2f3d35
commit 286056678a

View File

@ -28,7 +28,6 @@ int main() {
int i, found = 0;
// Remove the newline character from the temp_name array
temp_name[strcspn(temp_name, "\n")] = '\0';
for (i = 0; i < num_accepted; i++) {
@ -38,15 +37,15 @@ int main() {
}
}
if (!found) {
if (!found && num_accepted < MAX_STUDENTS) {
strcpy(names[num_accepted], temp_name);
num_accepted++;
}
num_students++;
// Check if we have reached the maximum number of accepted students
if (num_accepted == max_students) {
break; // Exit the loop
break;
}
}