qsort 763 B

123456789101112131415161718192021222324252627282930313233
  1. .TH QSORT 2
  2. .SH NAME
  3. qsort \- quicker sort
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .B
  10. .nf
  11. void qsort(void *base, long nel, long width,
  12. .B
  13. int (*compar)(void*, void*))
  14. .fi
  15. .SH DESCRIPTION
  16. .I Qsort
  17. (quicker sort)
  18. sorts an array into nondecreasing order.
  19. The first argument is a pointer to the base of the data;
  20. the second is the number of elements;
  21. the third is the width of an element
  22. in bytes;
  23. the last is the name of a comparison routine
  24. to be called with pointers
  25. to elements being compared.
  26. The routine must return
  27. an integer less than, equal to, or greater than 0
  28. according as the first argument is to be considered
  29. less than, equal to, or greater than the second.
  30. .SH SOURCE
  31. .B /sys/src/libc/port/qsort.c
  32. .SH "SEE ALSO"
  33. .IR sort (1)