Initialization

This commit is contained in:
Kozar 2024-04-22 18:10:05 +02:00
parent 42acfb719a
commit 3705b17f77

View File

@ -5,7 +5,7 @@
#define NAME_SIZE 50 #define NAME_SIZE 50
int main() { int main() {
int max_students, num_accepted = 0; int max_students, num_accepted = 0, num_students = 0;
char names[MAX_STUDENTS][NAME_SIZE]; char names[MAX_STUDENTS][NAME_SIZE];
char temp_name[NAME_SIZE]; char temp_name[NAME_SIZE];
@ -32,6 +32,7 @@ int main() {
strcpy(names[num_accepted], temp_name); strcpy(names[num_accepted], temp_name);
num_accepted++; num_accepted++;
} }
num_students++;
} }
if (num_accepted == 0) { if (num_accepted == 0) {
@ -43,7 +44,7 @@ int main() {
} }
} }
if (num_accepted < max_students) { if (num_accepted < max_students && num_accepted < num_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]);