Something similar is used with qsort(), declared in stdlib.h. You have to supply qsort() with a comparison function which takes two pointers-to-void and returns an int.
The key is the use of void * arguments. Pointers-to-void allow any type of data item to be used with qsort(). Within your comparison function you cast the pointers back to pointers-to-mytype, where mytype is the type of the items in the array you're sorting: ints, doubles, structs, whatever. It may seem a bit strange, but it works. Look for examples on the web. Hope this helps. David
