#include #include int int_compare(const void* av, const void* bv){ const int *a = av, *b = bv; if(*a < *b) return -1; if(*a == *b) return 0; return 1; } int main(){ int A[] = {5, 6, 2, 1, 45, 67, 8, 3, -2}; qsort(A, 9, sizeof(int), int_compare); for(int i = 0; i < 9; i++) printf("%d ", A[i]); printf("\n"); // This version computes the size of A rather than just having us count qsort(A, sizeof(A)/sizeof(*A), sizeof(*A), int_compare); return 0; }