VMS Help  —  CRTL  qsort
    Sorts an array of objects in place. It implements the quick-sort
    algorithm.

    Format

      #include  <stdlib.h>

      void qsort  (void *base, size_t nmemb, size_t size, int
                  (*compar) (const void *, const void *));

1  –  Function Variants

    The qsort function has variants named _qsort32 and _qsort64 for
    use with 32-bit and 64-bit pointer sizes, respectively.

2  –  Arguments

 base

    A pointer to the first member of the array. The pointer should be
    of type pointer-to-element and cast to type pointer-to-character.

 nmemb

    The number of objects in the array.

 size

    The size of an object, in bytes.

 compar

    A pointer to the comparison function.

3  –  Description

    Two arguments are passed to the comparison function pointed to
    by compar. The two arguments point to the objects being compared.
    Depending on whether the first argument is less than, equal to,
    or greater than the second argument, the comparison function
    returns an integer less then, equal to, or greater than 0.

    The comparison function compar need not compare every byte, so
    arbitrary data might be contained in the objects in addition to
    the values being compared.

    The order in the output of two objects that compare as equal is
    unpredictable.
Close Help