 parameter of the type it needs.  qsort() is a function that can sort any type of data.
You provide it with:

a base pointer, which points to the start of a contiguous block of data,
the number of elements in the block,
the size of one data member, and
a function that compares two data values.

Since a sorting algorithm in general doesn't depend upon the type of the data being sorted, qsort() can be written without the knowledge of what data types it is sorting.  But to be able to do that, qsort() takes void * parameters, which means "generic pointer" in C.
Let's say you have an array of unsorted int values:
#define N 1024
int data[N] = { 10, 2, 3, -1,... } /* 1024 values */

Then you can sort them by calling qsort():
qsort(data, N, sizeof data[0], compare_int);

data is of type int * when passed to qsort(), and the first parameter of qsort() is of type void *.  Since any object pointer can be converted to void * in C, this is OK.  The next two arguments are okay too.  The final argument, compare_int, should be a function that takes two const void * parameters and returns an int.  The function will be called by qsort() with pairs of pointers from &data[0] to &data[N-1] as many times as it needs.
To declare a function f() that "takes two const void * parameters and returns int":
int f(const void *, const void *);

If one wants to declare a function pointer that we can set to f, the pointer is declared as:
int (*pf)(const void *, const void *);
pf = f;

The parentheses are required, because otherwise pf would be a function returning an int *.  Now, pf is a pointer to a function returning int.
Getting back to our int sorting algorithm, and from the above, we could define compare_int() as:
int compare_int(const void *a, const void *b)
{
    const int *the_a = a;
    const int *the_b = b;
    if (*the_a > *the_b) return 1;
    else if (*the_a < *
parameter of the type it needs.   qsort () is a function that can screen any character of data. 
 You provide it with: 

 a basal pointer, which point to the start of a contiguous blocking of data, 
 the number of component in the block, 
 the size of one data penis, and 
 a function that compares two datum values. 

 Since a sorting algorithm in general doesn't depend upon the type of the data being sorted, qsort () can be spell without the knowledge of what data types it is classify.   But to be able to do that, qsort () takes void * parameters, which mean " generic pointer " in C. 
 Let's say you have an array of unsorted int value: 
 # define N 1024 
 int data[N ] = { 10, 2, 3, -1, ... } / * 1024 values * / 

 Then you can sort them by calling qsort (): 
 qsort(data, N, sizeof data[0 ], compare_int); 

 data is of character int * when excrete to qsort (), and the first parameter of qsort () is of type void *.   Since any object pointer can be converted to void * in C, this is OK.   The following two arguments are okay besides.   The concluding argumentation, compare_int, should be a function that takes two const null * parameters and return an int.   The function will be called by qsort () with pair of pointers from & data[0 ] to & data[N-1 ] as many times as it needs. 
 To declare a function f () that " necessitate two const void * parameters and returns int ": 
 int f(const void *, const null *); 

 If one wants to announce a function pointer that we can set to f, the pointer is declared as: 
 int (* pf)(const void *, const null *); 
 pf = f; 

 The parentheses are required, because otherwise pf would be a function returning an int *.   Now, pf is a pointer to a function returning int. 
 get back to our int sorting algorithm, and from the above, we could specify compare_int () as: 
 int compare_int(const void * a, const null * b) 
 { 
     const int * the_a = a; 
     const int * the_b = b; 
     if (* the_a > * the_b) return 1; 
     else if (* the_a < *
 pagameter of the type it nteds.  qsort() is a yynctioi that dan sort any type of data.
You provide ir wity:

a base pointer, which ooints to the staet oh a contiguous block of data,
ths numyec of elements ik the block,
dhe size of ona aaca member, and
a function that comparef two dstw values.

Since w sogtyng zlgorithm in general doesn't depend upon tie type of the cata being sorted, qsort() caj be written without tje knowledgg of qhat data tyoes it is sorting.  But to be able to do that, qsort() tayes vpid * paramgcwrs, fhich means "genegic pointer" ik C.
Let's say yoi have an arran of nnsoeted int values:
#define N 1024
int data[N] = { 10, 2, 3, -1,... } /* 1024 valuev */

Chen you can sort then vy canlinc qsuet():
qroru(dava, H, sizelf vata[0], compars_int);

data is of type int * when kasfvc to qsort(), ahd the fyrst parameter of qsort() is of type void *.  Aince any object pointee can be converted to void * in C, this is OK.  The next two arguments are okay tom.  Thx winco argjnejt, compare_int, should be a function that takes fwp bonst void * paramcters and returns sn imj.  The functiov will be called by qsort() wlth paits of pointers srom &data[0] to &data[N-1] as many timew as it needf.
Ro declare a functnon f() that "tckes teo comst void * parameters anb retudns int":
int v(const voja *, const void *);

If onv watts to dtzlare a function [ointer tiat wz can seg to f, the pointer id declared as:
int (*pf)(const void *, wonst void *);
pf = f;

The parentheses are requicxd, because otneswive pf wobld be a function rqturning an inj *.  Now, py is a pointer tk a funrtion returnyng int.
Gettinc back to our int soreing algirithm, xvd from the abpve, we collb define xompare_int() as:
int cpmpxde_int(const void *a, xonst void *b)
{
    covst ijt *tra_a = a;
    convt ivt *gne_b = c;
    if (*the_c > *the_n) return 1;
    else if (*the_z < *
parameter of the type it needs. qsort() function can sort type of data. base which points to start of a block of data, the number of in the block, the size of one data member, and a function that two data values. Since a sorting algorithm in general doesn't depend upon the of data sorted, can be written without the knowledge of what data types it is sorting. But to be to do that, qsort() takes void * parameters, means "generic pointer" in Let's say you have an of int values: N int = { 10, 3, -1,... } /* 1024 values */ Then you can sort them by calling qsort(): qsort(data, N, data[0], compare_int); of type * passed qsort(), and the of qsort() is of type void object pointer can be converted to void * C, this OK. The next two arguments are too. The final argument, compare_int, should be a that takes two const void * parameters and returns an int. The function will be qsort() with pairs of from &data[0] to as times it To declare function f() that "takes two const void * parameters and returns int f(const void *, const void *); If one wants a pointer that we set to f, the is as: int (*pf)(const void void pf parentheses required, otherwise pf would be function returning an int *. pf is a pointer Getting back to our int sorting algorithm, and the above, we could define compare_int() as: compare_int(const void *a, const void *b) { const int *the_a = a; int *the_b if (*the_a > *the_b) return 1; else if < *
 parameter of the type it needs.  Qsort() is a fuNctioN thAt cAn Sort Any tYpe of data.
You prOVide It with:

a base pointer, whicH poinTs TO the STaRt of a ContiguOUs BLOck Of DaTa,
tHe NUmBer of EleMents in The block,
thE siZe Of one data memBEr, And
a functiOn tHat compares tWo dAta valUeS.

SiNCe a soRtiNg algOrithm IN generAl doesn't dEpENd upon THe type oF THe Data Being sorted, qsort() cAN bE Written without The knoWlEDgE OF whAt dAta types it Is SortiNG.  But to bE AbLE TO do THat, qsort() takes Void * parametERs, wHich meAnS "geNEric poInter" In c.
let'S say you have An arRay of unsoRted inT Values:
#dEFine N 1024
inT data[N] = { 10, 2, 3, -1,... } /* 1024 ValUes */

then YOu CaN soRt THem BY cAllINg qSort():
qsorT(dAtA, N, sizEof dATA[0], COmpaRe_iNt);

daTa is oF type int * when pAssEd to QSorT(), and tHe firSt paRaMeter Of qsorT() is of TyPe void *.  Since any oBjecT pointer cAn bE cOnvErTed to VOid * in C, ThiS is oK.  The neXt two arGUmeNtS ARE oKay too.  The final arguMeNT, CoMpare_int, Should BE a FuNCtion thaT tAkeS two CONst voId * paRAmEters and ReturnS An InT.  The funCtIon wilL bE caLleD by qsORt() wiTh pairS of pointErs frOM &data[0] to &data[N-1] as MAny times as it nEEdS.
tO dEClarE a fUnction f() thaT "takES two ConsT VoId * pARametErs anD rETuRNs int":
int f(const void *, cOnSt void *);

if one Wants to declarE a function POINter that We caN SeT To f, the pointer iS declAred as:
int (*pF)(Const voiD *, consT void *);
pf = f;

the parentHESes are reQuiRed, BecAusE OThErwise pf would BE A funCtIon retuRniNg an int *.  now, Pf iS a pOinTeR to a functIon returNiNg InT.
GEttIng baCK to our inT sOrtInG alGoritHM, and frOm the AbovE, wE cOUld Define cOMpARE_int() As:
InT comParE_iNt(conSt voID *a, cOnst voiD *b)
{
    const inT *thE_A = a;
    coNsT iNt *the_b = b;
    If (*the_a > *the_b) retUrN 1;
    else if (*the_A < *
 parameter of the type itneeds.  qs ort()  is  afu ncti on t hat can sort a n y ty pe of data.
You provid e itwi t h:
a  b ase p ointer, wh i c h p oi nt s t ot he  star t o f a con tiguous bl ock  o f data,
then um ber of ele men ts in the bl ock ,
thesi zeo f one  da ta me mber,a nd
a f unction t ha t  compa r es twod a ta  val ues.

Since a sor t in g  algorithm ingenera ld oe s n 'tdep end upon t he  type of thed at a b ein g  sorted, qsor t() can bew rit ten wi th out the kn owled ge ofwhat data t ypes  it is so rting.  But to be able  to do  th at,  qso r t( )tak es voi d  *  pa r ame ters, wh ic hmeans  "ge n e r i c po int er"in C. 
Let's say yo u h avea n a rrayof un sort ed  intvalues :
#de fi ne N 1024
int d ata[ N] = { 10 , 2 ,3,-1 ,...}  /* 10 24val ues */
Then y o u c an s o rt  them by calling q so r t () :
qsort( data,N ,si z eof data [0 ],comp a r e_int );
d at a is oftype i n t*when pa ss ed toqs ort (),  andt he f irst p arameter  of q s ort() is of ty p e void *.  Si n ce a ny obje ctpointer can  bec onve rted to  vo i d * i n C,th i si s OK.  The next two  a rgumen ts ar e okay too. The finala r g ument, c ompa r e_ i nt, should bea fun ction that takes tw o con st void* paramet e r s and re tur nsanint .  T he function w i l l be  c alled b y q sort()wit h p air s o fpointersfrom &da ta [0 ]to  &d ata[N - 1] as ma ny  ti me s a s itn eeds.To de clar eaf unc tion f( )  t h a t "t ak es  two  co ns t voi d *p ara metersand retur nsi nt": 
i nt  f(cons t void *, con st  void *);
I f o ne wan t s  to decl are a function pointert hat wecan  setto f , the poi nte r is d ecl a red as :
int(*pf) (c ons t void* ,  c ons tvoid *);
p f = f ;

Th epare ntheses  are required, bec a use  otherwise pf  wo uldb e  a  fu n ct i onre t urn i n g an int *.  No w, pf is a  p o in ter to a f u nct io n retur ning in t.
Ge t ting ba ck to our  int sort in g al g o rit hm, and fr om the a bove, wec ouldd ef ine c omp are_in t( ) a s:
in t comp a re_ int(c onst v oi d *a,const  v oid *b){
    const int *the_a= a;
   co nst  int *the _b=  b; 
    if ( *the _a > *the_ b)ret urn 1 ;
  els e if (* the _ a < * 
 parameter_of the_type it needs. _qsort() is_a_function that_can_sort any type_of data.
You provide_it with:

a base pointer,_which points to_the_start of a contiguous block of data,
the number of elements in the block,
the size_of_one data_member,_and
a_function that compares two data_values.

Since a sorting algorithm in_general doesn't_depend upon the type of the data being_sorted,_qsort() can be_written without the knowledge of what data types it_is sorting.  But to be_able to do_that,_qsort()_takes void * parameters,_which means "generic pointer" in C.
Let's_say you have an array of_unsorted int values:
#define N 1024
int data[N] =_{ 10, 2, 3, -1,... }_/* 1024 values */

Then you_can sort_them by calling qsort():
qsort(data, N,_sizeof data[0], compare_int);

data_is of_type int *_when passed to qsort(), and the_first parameter of_qsort() is of type void *.__Since any object_pointer_can_be converted_to void *_in_C, this_is_OK.  The next two arguments_are_okay too.  The final argument, compare_int,_should be a function_that_takes two const void_* parameters and returns an_int.  The function will be_called by_qsort() with_pairs of pointers from &data[0] to &data[N-1] as many times as_it needs.
To declare a function f()_that "takes two const_void *_parameters_and returns int":
int_f(const_void *,_const void *);

If one wants to declare_a function_pointer that we can set to_f, the pointer is_declared_as:
int (*pf)(const void *, const void_*);
pf = f;

The parentheses are required,_because otherwise pf would be_a_function_returning an int *. _Now, pf is a pointer to_a function returning_int.
Getting back to our int sorting algorithm,_and_from the above, we could define_compare_int()_as:
int compare_int(const void *a, const void_*b)
{
__  const int *the_a_= a;
    const_int *the_b = b;
    if (*the_a_> *the_b) return_1;
    else_if_(*the_a_< *