manual page distributed with 4.2BSD
[unix-history] / usr / src / share / man / man3f / qsort.3
CommitLineData
23230e77
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
9abd7cb9 5.\" @(#)qsort.3 6.1 (Berkeley) %G%
23230e77 6.\"
9abd7cb9 7.TH QSORT 3F ""
23230e77
KM
8.UC 5
9.SH NAME
10qsort \- quick sort
11.SH SYNOPSIS
12.B subroutine qsort (array, len, isize, compar)
13.br
14.B external compar
15.br
16.B integer*2 compar
17.SH DESCRIPTION
18One dimensional
19.I array
20contains the elements to be sorted.
21.I len
22is the number of elements in the array.
23.I isize
24is the size of an element, typically -
25.sp 1
26.in +5
274 for
28.B integer
29and
30.B real
31.br
328 for
33.B "double precision"
34or
35.B complex
36.br
3716 for
38.B "double complex"
39.br
40(length of character object) for
41.B character
42arrays
43.in -5
44.sp 1
45.I Compar
46is the name of a user supplied integer*2 function
47that will determine the sorting order.
48This function will be called with 2 arguments that will be elements of
49.I array.
50The function must return -
51.sp 1
52.in +5
53negative if arg 1 is considered to precede arg 2
54.br
55zero if arg 1 is equivalent to arg 2
56.br
57positive if arg 1 is considered to follow arg 2
58.in -5
59.sp 1
60On return, the elements of
61.I array
62will be sorted.
63.SH FILES
64.ie \nM /usr/ucb/lib/libU77.a
65.el /usr/lib/libU77.a
66.SH "SEE ALSO"
67qsort(3)