From 78ce6b4670aaa74e75b31d38f3e2a8b49dc1b60f Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 25 Apr 2024 20:03:57 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index 0aebb24..bb916f9 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -10,7 +10,7 @@ int main() { int count; char buffer[100]; char **applications; - int i, j; + int i; if (scanf("%d", &count) != 1 || count <= 0) { printf("Nespravny vstup\n"); @@ -30,7 +30,7 @@ int main() { buffer[len - 1] = '\0'; } int found = 0; - for (j = 0; j < i; j++) { + for (int j = 0; j < i; j++) { if (strcmp(applications[j], buffer) == 0) { found = 1; break; @@ -51,19 +51,12 @@ int main() { qsort(applications, i, sizeof(char *), compare_names); printf("Prijati studenti:\n"); - for (j = 0; j < i; j++) { + for (int j = 0; j < i; j++) { printf("%s\n", applications[j]); } - if (count < i) { - printf("Neprijati studenti:\n"); - for (; j < i; j++) { - printf("%s\n", applications[j]); - } - } - // Free allocated memory - for (j = 0; j < i; j++) { + for (int j = 0; j < i; j++) { free(applications[j]); } free(applications);