Man Page qsort.3f




NAME

     qsort, qsort64 - quick sort


SYNOPSIS

      integer*4 len, isize
      integer*8 len8, isize8
      external compar
      integer*2 compar

     subroutine qsort (array, len, isize, compar)
     subroutine qsort64(array,len8, isize8, compar)


DESCRIPTION

     One-dimensional array contains the elements  to  be  sorted.
     len (or len8) is the number of elements in the array.  isize
     (or isize8) is the size of an element, typically:

          4 for integer and real (or 4_8 with qsort64)
          8 for double precision or complex (or 8_8 with qsort64)
          16 for double complex (or 16_8 with qsort64)
          or the length of a character  element  (in  bytes)  for
          character arrays

     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 array. The  function
     must return:

          negative if arg1 is considered to precede arg2
          zero if arg1 is equivalent to arg2
          positive if arg1 is considered to follow arg2

     On return, the elements of array are sorted.

     Use 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 INTEGER*8 value.


NOTES

     When using qsort64, be sure to  specify  the  element  size,
     isize8,  and  the  array  length,  len8,  as INTEGER*8 data.
     Specify INTEGER*8 constants using the Fortran 90 syntax, for
     example 8_8, as in:

         integer*8 LENARRAY, ARRAY(large_number)
         integer*2 ORDER
         external ORDER
         ...
         call qsort64(ARRAY, LENARRAY, 8_8, ORDER)


FILES

     libF77.a


SEE ALSO

     qsort(3c)