Initialization
This commit is contained in:
parent
68af96e75f
commit
a56e7176ad
@ -10,7 +10,7 @@ int main() {
|
|||||||
int count;
|
int count;
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
char **applications;
|
char **applications;
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
if (scanf("%d", &count) != 1 || count <= 0) {
|
if (scanf("%d", &count) != 1 || count <= 0) {
|
||||||
printf("Nespravny vstup\n");
|
printf("Nespravny vstup\n");
|
||||||
@ -30,7 +30,7 @@ int main() {
|
|||||||
buffer[len - 1] = '\0';
|
buffer[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for (int j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
if (strcmp(applications[j], buffer) == 0) {
|
if (strcmp(applications[j], buffer) == 0) {
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
@ -51,12 +51,19 @@ int main() {
|
|||||||
qsort(applications, i, sizeof(char *), compare_names);
|
qsort(applications, i, sizeof(char *), compare_names);
|
||||||
|
|
||||||
printf("Prijati studenti:");
|
printf("Prijati studenti:");
|
||||||
for (int j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
printf("%s\n", applications[j]);
|
printf("%s\n", applications[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count < i) {
|
||||||
|
printf("Neprijati studenti:");
|
||||||
|
for (; j < i; j++) {
|
||||||
|
printf("%s\n", applications[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Free allocated memory
|
// Free allocated memory
|
||||||
for (int j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
free(applications[j]);
|
free(applications[j]);
|
||||||
}
|
}
|
||||||
free(applications);
|
free(applications);
|
||||||
|
Loading…
Reference in New Issue
Block a user