Initialization

This commit is contained in:
Kozar 2024-04-25 20:03:57 +02:00
parent 7760084e5a
commit 78ce6b4670

View File

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