I have a problem compiling a program that uses 'qsort' I have to sort a dynamic array of pointers to a struct (called Element) when I try to compile the program I get the following error: "error: passing argument 4 of 'qsort' from incompatible pointer type..."
my compare function (for qsort) is:
int compareElements(const void **e1, const void **e2)
{
Elemenet* element1 = *(Element** const)e1;
Elemenet* element2 = *(Element** const)e2;
if (element1->key < element2->key)
return -1;
...................
}
Can anyone say what's wrong please.. ? I've tried so many patterns of altering that compare function and still nothing
Thank you
int compareElements(const void *e1, const void *e2)- BLUEPIXYqsortmanual entry gives the signature of the comparison function:int cmp(const void *a, const void *b)... yours doesn't have that signature. - Jim Balter