Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Programming/Code/Standard C Library/Functions/qsort

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

qsort #include <cstdlib> void* qsort( const void *base, size_t num, size_t size, int (*compare)(const void *, const void *)); The function qsort() performs a Quick sort on an array. Note that some implementations may instead use a more efficient sorting algorithm. *base refers to the array being sorted. This array contains num elements, each of size size. The compare function accepts two pointers to the object within the array - which need to first be cast to the object type being examined. The function returns -1 if the first parameter should be before the second, 1 if the first parameter is after, or 0 if the object matches. Related topics bsearch