This commit is contained in:
Matus Tokarcik 2024-03-21 23:10:29 +01:00
parent 0a1a0045b5
commit 212b8434e1

View File

@ -13,6 +13,11 @@ struct student {
int compare_students(const void *a, const void *b) {
const struct student *student_a = (const struct student *)a;
const struct student *student_b = (const struct student *)b;
if (student_a->votes == student_b->votes) {
return strcmp(student_a->name, student_b->name);
}
return (student_b->votes - student_a->votes);
}