From 3705b17f779f9cd1c8089fcb1a5c77838bf0a23d Mon Sep 17 00:00:00 2001 From: ak643du Date: Mon, 22 Apr 2024 18:10:05 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index fc33e68..acabd87 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -5,7 +5,7 @@ #define NAME_SIZE 50 int main() { - int max_students, num_accepted = 0; + int max_students, num_accepted = 0, num_students = 0; char names[MAX_STUDENTS][NAME_SIZE]; char temp_name[NAME_SIZE]; @@ -32,6 +32,7 @@ int main() { strcpy(names[num_accepted], temp_name); num_accepted++; } + num_students++; } 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:"); for (int i = num_accepted; i < max_students; i++) { printf("%s", names[i]);