tfQSort

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


void tfQSort (
void * a,
unsigned int n,
unsigned int es,
ttCmpFuncPtr cmpFuncPtr
);


Function Description

tfQSort() sorts the array pointed to by a. There are 'n' elements of size 'es' in this array. These elements are sorted according to a comparison function, pointed to by cmpFuncPtr. This function is defined as:

typedef int (* ttCmpFuncPtr)(const void * parmPtr1,
                             const void * parmPtr2);

This function should take the two parameters, parmPtr1 and parmPtr2, and should return 1 if the first element is greater than the second, 0 if they are equal or -1 if the first element is less than the second.


Parameters

  • a
    Pointer to the array to be sorted.
  • n
    Number of elements in the above array.
  • es
    Size of each element in the array.
  • cmpFuncPtr
    Pointer to the function used to compare array elements.


Table of Contents >> Programmer's Reference