skuska
This commit is contained in:
parent
3b454f509a
commit
9850cd5463
@ -8,8 +8,8 @@ typedef struct student {
|
||||
} student_t;
|
||||
|
||||
int compare_students(const void *a, const void *b) {
|
||||
const student_t *student_a = a;
|
||||
const student_t *student_b = b;
|
||||
const student_t *student_a = (const student_t *)a;
|
||||
const student_t *student_b = (const student_t *)b;
|
||||
|
||||
if (student_a->vote_count > student_b->vote_count) {
|
||||
return -1;
|
||||
@ -35,7 +35,7 @@ int main() {
|
||||
students_capacity = (students_capacity + 1) * 2;
|
||||
student_t *new_students = realloc(students, students_capacity * sizeof(student_t));
|
||||
if (new_students == NULL) {
|
||||
fprintf(stderr, "Error");
|
||||
fprintf(stderr, "Chyba");
|
||||
return 1;
|
||||
}
|
||||
students = new_students;
|
||||
@ -51,9 +51,6 @@ int main() {
|
||||
printf("Results:\n");
|
||||
for (int i = 0; i < student_count; i++) {
|
||||
printf("%d %s\n", students[i].vote_count, students[i].name);
|
||||
}
|
||||
|
||||
for (int i = 0; i < student_count; i++) {
|
||||
free(students[i].name);
|
||||
}
|
||||
free(students);
|
||||
|
Loading…
Reference in New Issue
Block a user