01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

QSORT (3C) QSORT (3C)<br />

NAME<br />

qsort - quicker sort<br />

SYNOPSIS<br />

void qsort ((char *) base, nel, sizeof (•base), compar)<br />

unsigned int nel;<br />

int (*compar)( );<br />

DESCRIPTION<br />

Qsort is an implementation of the quicker-sort algorithm. It sorts<br />

a table of data in place.<br />

Base points to the element at the base of the table. Nel is the<br />

number of elements in the table. Compar is the name of the comparison<br />

function, which is called with two arguments that point to<br />

the elements being compared. The function must return an<br />

integer less than, equal to, or greater than zero according as the<br />

first argument is to be considered less than, equal to, or greater<br />

than the second.<br />

NOTES<br />

The pointer to the base of the table should be of type pointer-to<br />

element, and cast to type pointer-to-character.<br />

The comparison function need not compare every byte, so arbitrary<br />

data may be contained in the elements in addition to the<br />

values being compared.<br />

Although declared as type pointer-to-character, the value returned<br />

should be cast into type pointer-to-element.<br />

SEE ALSO<br />

sort(l), bsearch(3C), lsearch(3C), string(3C).<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!