In the below function compare..

int compare (const void * a, const void * b)
return ( *(int*)a - *(int*)b );

What is the exact meaning of *(int*)a, There are two pointers , what does the starting pointer signifies.. is this a return pointer...??

The (int*) is a typecast. It is converting 'a' from type const void* to type int*.

The lone * on the left is the dereference operator. It is telling the compiler to look at the integer stored at the memory pointed to by a.
Topic archived. No new replies allowed.