Here are the following announcements:
void qsort(void *lineptr[], int left, int right, int (*comp)(void *, void *));
int numcmp(char *, char *);
int strcmp(char *s, char *t);
Then, somewhere in the program there is the following call:
qsort((void**) lineptr, 0, nlines-1,
(int (*)(void*,void*))(numeric ? numcmp : strcmp));
(Ignore the first three arguments and numeric).
I ask what it is:
(int (*)(void*,void*))(numeric ? numcmp : strcmp)
I understand that I’m qsortexpecting a “function pointer” that receives two pointers voidand returns int“as the 4th argument, but how does what is written above satisfy this? It seems to me that this is some kind of cast, because it consists of two parentheses, but that would be very strange. Because it takes a function and makes this function “a pointer to a function that gets two pointers voidand returns int.” That doesn't make sense.
(I followed this rule that the type typein parentheses before the variable pushes the variable to this type).
So, I think I'm just wrong, maybe someone can tell me how to read this, what order?