title: difference between function pointers in c and c++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2064692/how-to-print-function-pointers-with-cout">How to print function pointers with cout?</a>  </p>
  </blockquote>
  
  
  
  <p>What is the difference between function pointers in c and c++? When I'm printing function pointer in c++ it's giving 1, but in c it's giving an address.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int fun()
  {}
  
  typedef int (*f)();
  
  
  int main()
  {
      f test = fun;
      std::cout &lt;&lt; reinterpret_cast&lt;f&gt;(test);
  }
  
  
  #include &lt;stdio.h&gt;
  
  int fun()
  {}
  
  int (*f)();
  
  int main()
  {
      f = fun;
      printf("%p", f);
  }
  </code></pre>