qsort

Performs a quick sort.

void qsort (void * base, size_t num, size_t width, int (*compare)(void * element1, void * element2));

Required Header
<stdlib.h>

Return Value

None.

Parameters

base

  Base pointer of the array to sort

num

  The number of elements in the array

width

  The width in bytes of each element

compare

  A user written compare function to that takes two parameters:

element1, element2

  pointer to the key, and an element within the array to be checked

Remarks

The qsort function calls the user supplied function compare using the elements within the array and performs a sort using the results. The array is overwritten. The compare function should return the following values:

  < 0 : element1 is less than element2
  = 0 : element1 is equal to element2
  > 0 : element1 is greater than element2

Standard Library

See Also    bsearch _lfind, _lsearch,

This module is Copyright (C) 1991, 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
Modified source code to the compiled object is included in the jcc download package.