title: C "function pointer" typedef without asterisk?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3674200/what-does-this-typedef-mean-a-function-prototype">what does this typedef mean? a function prototype ?</a>  </p>
  </blockquote>
  
  
  
  <p>Today I came across this syntax</p>
  
  <pre><code>typedef double (d2d)(double);
  </code></pre>
  
  <p><a href="http://cdecl.ridiculousfish.com/?q=double+%28f%29%28double%29%3B" rel="nofollow noreferrer">cdecl tells me</a> it's a function returning a double (as opposed to a pointer to a function returning a double). So let's see how it works:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  typedef double (d2d)(double);
  //typedef double (*d2d)(double); // the "usual" way
  
  double twice(double x)
  {
      return x * 2.0;
  }
  
  double apply(d2d f, double x)
  {
      return f(x);
  }
  
  
  int main()
  {
      printf("%f\n", apply(twice, 2.0)); // Prints 4.0000
      return 0;
  }
  </code></pre>
  
  <p>Surprisingly, GCC 4.2.1 compiled it without problems. I'm just curious to know what are the subtle differences between this and the "usual" way to <code>typedef</code> a function pointer?</p>