.\" @(#)qsort.3f 1.3 86/01/02 SMI; from UCB 4.2 .TH QSORT 3F "98/09/21" .SH NAME qsort, qsort64 \- quick sort .SH SYNOPSIS .\" .IX qsort "" \fLqsort\fP .IX "quick sort" .IX "sort quick" .\" .B \ integer*4 len, isize .br .B \ integer*8 len8, isize8 .br .B \ external compar .br .B \ integer*2 compar .sp .B subroutine qsort (array, len, isize, compar) .br .B subroutine qsort64(array,len8, isize8, compar) .SH DESCRIPTION One-dimensional .I array contains the elements to be sorted. .I len (or .IR len8 ) is the number of elements in the array. .I isize (or .IR isize8 ) is the size of an element, typically: .sp 1 .in +5 4 for .B integer and .B real (or 4_8 with qsort64) .br 8 for .B "double precision" or .B complex (or 8_8 with qsort64) .br 16 for .B "double complex" (or 16_8 with qsort64) .br or the length of a character element (in bytes) for .B character arrays .in -5 .sp 1 .I compar is the name of a user-supplied INTEGER*2 function that determines the sorting order. This function is called with two arguments that are elements of .I array. The function must return: .sp 1 .in +5 negative if .I arg1 is considered to precede .I arg2 .br zero if .I arg1 is equivalent to .I arg2 .br positive if .I arg1 is considered to follow .I arg2 .in -5 .sp 1 On return, the elements of .I array are sorted. .sp Use .B qsort64 in 64-bit environments where the size of the array (or character array element) exceeds 2 Gigabytes and can only be specified with an .B INTEGER*8 value. .\" .SH NOTES When using .BR qsort64 , be sure to specify the element size, .BR isize8 , and the array length, .BR len8 , as INTEGER*8 data. Specify INTEGER*8 constants using the Fortran 90 syntax, for example .BR 8_8 , as in: .sp .B \ \ \ integer*8 LENARRAY, ARRAY(large_number) .br .B \ \ \ integer*2 ORDER .br .B \ \ \ external ORDER .br .B \ \ \ ... .br .B \ \ \ call qsort64(ARRAY, LENARRAY, 8_8, ORDER) .SH FILES .\" .B libF77.a .SH "SEE ALSO" .BR qsort (3)