title: How to print the address of a function with cout in C++?
body: <p>I cannot understand how to print the address of a function in C++:
  My simple code is the following:</p>
  <pre><code>#include&lt;iostream&gt;
  
  int my_fun () {
            return 5 ; 
  } 
  
  
  int main () {
  
  
  int (*fp)() = my_fun ; 
  
  std::cout &lt;&lt; &amp;fp &lt;&lt;std::endl ; 
  std::cout&lt;&lt;my_fun&lt;&lt;std::endl ; 
  printf(&quot;%p\n&quot;,my_fun) ; 
  std::cout&lt;&lt;(int*)my_fun&lt;&lt;std::endl ; 
  }
  </code></pre>
  <p>but I cant understand why the</p>
  <pre><code>std::cout&lt;&lt;my_fun&lt;&lt;std::endl ; 
  
  </code></pre>
  <p>is giving me the number 1 while (int*)my_fun is giving me the right address.
  Sorry if the question is trivial.</p>
  <p>This is the output of the program:</p>
  <pre><code>0x7fffed0713b0
  1
  0x7ff14f7ca209
  0x7ff14f7ca209
  </code></pre>