If you look, the error is quite clear: __compar_fn_t
has type int(*)(const void*, const void*)
but your function is int(*)(struct Record*, struct Record*)
. Quicksort doesn't know about the type of your array, so you have to use void*
for your comparator arguments and then cast them to the appropriate types inside it:
int compare (const void *a, const void *b){
struct Record const* a_r = (struct Record const*)a,
* b_r = (struct Record const*)b;
return (a_r->key - b_r->key);
}