[comp.lang.c] Quick Sort in C

STEIMLE@zeus.unl.edu (Scott A.) (07/19/89)

I'm not at all acquainted with C, but need a short section of code to
perform a quick sort.  Does anyone out there have this?

Thanks in advance.

Scott.

gwyn@smoke.BRL.MIL (Doug Gwyn) (07/19/89)

In article <2762@zeus.unl.edu> STEIMLE@zeus.unl.edu (Scott A.) writes:
>I'm not at all acquainted with C, but need a short section of code to
>perform a quick sort.  Does anyone out there have this?

It should already exist in your C library, under the name qsort().
All you have to do is set up the array to be sorted (which might
consist of pointers to other objects), provide a function that
knows how to compare the order of two records in the array, and
invoke the library function to perform the quicksort algorithm.