I was trying to understand pointers to functions and came across qsort program

can you guys tell me how the compare function "record_compare" works
given the function
Code:
typedef struct {
int key;
} Record
and

Code:
int record_compare (void cons *a, void const *a)
{ return ( ((Record *)a)->key - ((Record *)b)->key);
}