Question: The call to qsort must pass in a function pointer for a compare function to be used in sorting the array. The function header for

The call to qsort must pass in a function pointer for a compare function to be used in sorting the array. The function header for qsort is void qsort (void* base, //array to be sorted size_t n, //length of array size_t size, //size of each entry int (*cmp) const void *p, const void *q)//function pointer for compare function Which of the following function can be passed to qsort in order to sort an integer array? a) int int_cmp (int *p, int *q) {return *p - *q} b) int int_cmp (const void *p, const void *q) {return * (int *) p - * (int *) q;} c) int int_cmp (const void *p, const void *q) {return (int *) p - (int *) q;} d) int int_cmp (int *p, int *q) {return * (int *) p - * (int *)q;}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
