Initialization

This commit is contained in:
Kozar 2024-04-22 18:06:42 +02:00
parent 4203df9d14
commit 42acfb719a

View File

@ -8,7 +8,6 @@ int main() {
int max_students, num_accepted = 0; int max_students, num_accepted = 0;
char names[MAX_STUDENTS][NAME_SIZE]; char names[MAX_STUDENTS][NAME_SIZE];
char temp_name[NAME_SIZE]; char temp_name[NAME_SIZE];
int num_rejected = max_students;
scanf("%d", &max_students); scanf("%d", &max_students);
if (max_students <= 0 || max_students > MAX_STUDENTS) { if (max_students <= 0 || max_students > MAX_STUDENTS) {
@ -41,14 +40,10 @@ int main() {
printf("Prijati studenti:"); printf("Prijati studenti:");
for (int i = 0; i < num_accepted; i++) { for (int i = 0; i < num_accepted; i++) {
printf("%s", names[i]); printf("%s", names[i]);
if (i < num_accepted - 1) {
printf("\n");
} }
} }
num_rejected -= num_accepted;
}
if (num_rejected > 0) { if (num_accepted < max_students) {
printf("Neprijati studenti:"); printf("Neprijati studenti:");
for (int i = num_accepted; i < max_students; i++) { for (int i = num_accepted; i < max_students; i++) {
printf("%s", names[i]); printf("%s", names[i]);