C language library function (Q-letter)

xiaoxiao2021-03-06  44

Function name: Qsort

Function: Sort by rapid sort routine

Usage: Void Qsort (Void * Base, Int Nelem, Int Width, INT (* FCMP) ());

Example:

#include

#include

#include

INT Sort_function (const void * a, const void * b);

Char List [5] [4] = {"Cat", "Car", "CAB", "CAP", "CAN"}

Int main (void)

{

INT X;

Qsort (void *) list, 5, sizeof (list [0]), sort_function;

FOR (x = 0; x <5; x )

Printf ("% S / N", List [x]);

Return 0;

}

INT Sort_Function (const void * a, const void * b)

{

Return (Strcmp (A, B));

}

转载请注明原文地址:https://www.9cbs.com/read-74413.html

New Post(0)