title: Function pointers and address of a function
body: <p>So I figured when making function pointers, you do not need the <code>operator &amp;</code> to get the address of the initial function:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  double foo (double x){
      return x*x;
  }
  
  int main () {
  
      double (*fun1)(double) = &amp;foo;
      double (*fun2)(double) =  foo;
  
      printf("%f\n",fun1(10));
      printf("%f\n",fun2(10));
  
      printf("fun1 = %p \t &amp;foo = %p\n",fun1, &amp;foo);
      printf("fun2 = %p \t  foo = %p\n",fun2,  foo);       
  
      int a[10];
  
      printf("  a = %p \n &amp;a = %p  \n",a,&amp;a);
  
      return 0;
  }
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>&gt;./a.out 
  100.000000
  100.000000
  fun1 = 0x4004f4      &amp;foo = 0x4004f4
  fun2 = 0x4004f4       foo = 0x4004f4
    a = 0x7fff26804470 
   &amp;a = 0x7fff26804470 
  </code></pre>
  
  <p>Then I realized this is also true for arrays, meaning that if you have <code>int a[10]</code> both <code>a</code> and <code>&amp;a</code> point to the same location. Why is that with arrays and functions? Is the address saved in a memory location that has the same address as the value(address) being saved in it?</p>