title: A Question About Function Pointer In C
body: <p>There's the following declarations:</p>
  
  <pre><code>void qsort(void *lineptr[], int left, int right, int (*comp)(void *, void *));
  int numcmp(char *, char *);
  int strcmp(char *s, char *t);
  </code></pre>
  
  <p>Then, somewhere in the program there is the following call:</p>
  
  <pre><code>  qsort((void**) lineptr, 0, nlines-1, 
                      (int (*)(void*,void*))(numeric ? numcmp : strcmp));
  </code></pre>
  
  <p>(Ignore the first three arguments and <code>numeric</code>).</p>
  
  <p>I ask what is this:</p>
  
  <pre><code>(int (*)(void*,void*))(numeric ? numcmp : strcmp)
  </code></pre>
  
  <p>I understand that <code>qsort</code> is expecting a "pointer to function that gets two <code>void</code> pointers and returns an <code>int</code>" as it's 4th argument but how what's written above satisfies that?
  It seems to me like some sort of cast because it is made of two parentheses, but that would be a very odd cast. Because it takes a function and makes this function a "pointer to function that gets two <code>void</code> pointers and returns an <code>int</code>". Which is meaningless.<br>
  (I followed here the rule that a type <em><code>type</code></em> in parenthesis before a variable promotes the variable to that type).</p>
  
  <p>So I think I just get it wrong, maybe someone can tell me how to read this, what's the order?</p>