From 6c24ae98030df42fa766985e0cfa3d57cc1bcd3e Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 25 Apr 2024 17:37:53 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index 9776b0e..5cb434f 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -40,10 +40,13 @@ int main() { num_accepted++; } num_students++; + + // Check if we have reached the maximum number of accepted students + if (num_accepted == max_students) { + break; // Exit the loop + } } - names[num_accepted][0] = '\0'; - qsort(names, num_accepted, sizeof(char*) * NAME_SIZE, compare_names); if (num_accepted == 0) { @@ -56,4 +59,4 @@ int main() { } return 0; -} \ No newline at end of file +}