Initialization
This commit is contained in:
parent
6083688b7e
commit
0c6b56eb39
@ -29,18 +29,9 @@ int main() {
|
|||||||
if (len > 0 && buffer[len - 1] == '\n') { // Remove newline character if present
|
if (len > 0 && buffer[len - 1] == '\n') { // Remove newline character if present
|
||||||
buffer[len - 1] = '\0';
|
buffer[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
int found = 0;
|
|
||||||
for (j = 0; j < i; j++) {
|
|
||||||
if (strcmp(applications[j], buffer) == 0) {
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
applications[i] = strdup(buffer);
|
applications[i] = strdup(buffer);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
printf("Ziadne prihlasky\n");
|
printf("Ziadne prihlasky\n");
|
||||||
@ -50,13 +41,13 @@ int main() {
|
|||||||
// Sort the applications alphabetically
|
// Sort the applications alphabetically
|
||||||
qsort(applications, i, sizeof(char *), compare_names);
|
qsort(applications, i, sizeof(char *), compare_names);
|
||||||
|
|
||||||
printf("Prijati studenti:");
|
printf("Prijati studenti:\n");
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
printf("%s\n", applications[j]);
|
printf("%s\n", applications[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count < i) {
|
if (count < i) {
|
||||||
printf("Neprijati studenti:");
|
printf("Neprijati studenti:\n");
|
||||||
for (; j < i; j++) {
|
for (; j < i; j++) {
|
||||||
printf("%s\n", applications[j]);
|
printf("%s\n", applications[j]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user