'\"macro stdmacro
.if n .pH g3c.qsort @(#)qsort	40.12 of 10/27/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} qsort 3C "C Programming Language Utilities" "\&"
.if \nX=1 .ds x} qsort 3C "C Programming Language Utilities"
.if \nX=2 .ds x} qsort 3C "" "\&"
.if \nX=3 .ds x} qsort "" "" "\&"
.TH \*(x}
.SH NAME
\f4qsort\f1 \- quicker sort
.SH SYNOPSIS
.nf
.ft 4
#include <stdlib.h>
.P
\f4void qsort (void\(** base, size_t nel, size_t width), int (*compar)
    (const void *, const void *));
.ft 1
.fi
.SH DESCRIPTION
\f4qsort\fP
is an implementation
of the quicker-sort algorithm.
It sorts a table of data in place.
The contents of the table are sorted in ascending order according to the 
user-supplied comparison function.
.PP
.I base\^
points to the element at the base of the table.
.I nel\^
is the number of elements in the table.
.I width
specifies the size of each element in bytes.
.I compar\^
is the name of the comparison function,
which is called with two arguments that point
to the elements being compared.
The function must return an integer
less than, equal to, or greater than zero
to indicate if the first argument is to be considered
less than, equal to, or greater than the second.
.PP
The contents of the table are sorted in ascending order according to the
user supplied comparison function.
.SH SEE ALSO
\f4bsearch\fP(3C),
\f4lsearch\fP(3C),
\f4string\fP(3C).
.br
\f4sort\fP(1) in the
\f2User's Reference Manual\f1.
.SH NOTES
The comparison function need not compare every byte,
so arbitrary data may be contained in the elements in addition to the values
being compared.
.PP
The relative order in the output of two items that compare as equal is unpredictable.
.\"	@(#)qsort.3c	6.2 of 10/20/83
.Ee
