fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int compare(const void* left, const void* right) { return (*(int*)right - *(int*)left); }
  5. int main() {
  6. int (*cmp) (const void* , const void*) = &compare;
  7. int array[] = {1, 8, 0, 4, 6, 5, 1, 6, 9, 7};
  8. qsort(array, 10, sizeof(int), cmp);
  9. for (int i = 0; i < 10; i++) printf("%d ", array[i]);
  10. }
  11.  
  12. //https://pt.stackoverflow.com/q/322422/101
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
9 8 7 6 6 5 4 1 1 0