Practice ยท 2 of 4
Ascending, Descending, By Field
Implement a struct sort family with the boilerplate Entry type:
``c
int cmp_key_asc(const void *a, const void *b);
int cmp_key_desc(const void *a, const void *b); /* exact reverse of asc */
int cmp_name_asc(const void *a, const void *b); /* by name (strcmp) */
``
Sorting stability is NOT required by qsort โ but your comparators must each be
a consistent total order (equal keys return 0; equal names return 0).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Comparator Gym