title: Why the addresses of array- and pointer-argument of two different functions are the same?
body: <p>I have the following code from Chapter 9 of <em>Expert C Programming - Deep C Secrets</em> by Peter van der Linden.  </p>
  
  <pre><code>char ga[] = "abcdefghijklm";
  
  void my_array_func( char ca[10] )
  {
    printf(" addr of array param = %#x \n",&amp;ca);
    printf(" addr (ca[0]) = %#x \n",&amp;(ca[0]));
  }
  
  void my_pointer_func( char *pa )
  {
    printf(" addr of ptr param = %#x \n",&amp;pa);
    printf(" addr (pa[0]) = %#x \n",&amp;(pa[0]));
  }
  
  main()
  {
    printf(" addr of global array = %#x \n",&amp;ga);
    printf(" addr (ga[0]) = %#x \n",&amp;(ga[0]));
    my_array_func( ga );
    my_pointer_func( ga );
  }
  </code></pre>
  
  <p>The output looks like:</p>
  
  <pre><code>addr of global array = 0x870f018  
  addr (ga[0]) = 0x870f018  
  
  addr of array param = 0x574f17c8  
  addr (ca[0]) = 0x870f018  
  
  addr of ptr param = 0x574f17c8  
  addr (pa[0]) = 0x870f018  
  </code></pre>
  
  <p>I am confused why <code>addr of array param</code> and <code>addr of ptr param</code> are the same. As for me, <code>ca</code> and <code>pa</code> are two different pointers, and thus their addresses should be different. Anyone can help to explain? </p>
  
  <p>As a contrast:</p>
  
  <pre><code>main ()  
  {
    int a = 1;
    int *p1 = &amp;a;
    int *p2 = &amp;a;
  
    printf("add of p1 = %#x \n", &amp;p1);
    printf("add of p2 = %#x \n", &amp;p2);
  }
  </code></pre>
  
  <p>will give result of different addresses:     </p>
  
  <pre><code>addr of p1 = 0x50a687e0    
  addr of p2 = 0x50a687d8    
  </code></pre>
  
  <p>What's the difference between the two code pieces?</p>