function

Sep 1, 2012 at 6:39pm
HI ,
Can some one explain me what this function do . i am not able to understand what exactly the function do and how
1
2
3
4
5
6
7
int function( const void* x , const void* y)
{
   char* c1 = (char*) x; 
   char* y1 = (char*) y;
return *c1 - *y1;

}



Thanks in advance
blue.

Last edited on Sep 1, 2012 at 7:56pm
Sep 1, 2012 at 7:25pm
It returns the difference of the two bytes stored at those addresses.
Sep 1, 2012 at 7:56pm
Did you find this with an example of using qsort() somewhere?
You can read more about it here, plus a number of examples:
http://www.cplusplus.com/faq/sequences/sequencing/sort-stuff/#c
Topic archived. No new replies allowed.