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);