Question: Sample Data Structures Questions Chapter 13 Sorting (this question is from beyond the book) Suppose that you are writing a program that has these two
Sample Data Structures Questions Chapter 13 Sorting (this question is from beyond the book)
Suppose that you are writing a program that has these two functions available:
int compare_ints(const void* p1, const void* p2); // Precondition: p1 and p2 are really pointers to integers. // Postcondition: The return value is: // (a) negative if *p1 < *p2 // (b) zero if *p1 == *p2 // (c) positive if *p1 > *p2 void qsort( void* base, size_t n, size_t bytes, int compar(const void*, const void*) ); // Same specification as the standard library qsort function.
Your program also has an integer array called x, with 10 elements. Write two function calls: The first call uses qsort to sort all of x; the second call uses qsort to sort x[3]..x[9].
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
