title: What exactly is the array name in c?
body: <p>I am having a tough time understanding the type and use of the name of the array in C. It might seems a long post but please bear with me.</p>
  
  <p>I understand that the following statement declares <code>a</code> to be of type <code>int []</code> i.e <strong>array of integers</strong>.</p>
  
  <pre><code>int a[30];
  </code></pre>
  
  <p>While <code>a</code> also points the first element of array and things like <code>*(a+2)</code> are valid. Thus, making <code>a</code> look like a <strong>pointer to an integer</strong>. But actually the types <code>int []</code> and <code>int*</code> are different; while the former is an <strong>array type</strong> and later is a  <strong>pointer to an integer</strong>.</p>
  
  <p>Also a variable of type <code>int []</code> gets converted into a variable of type <code>int*</code> when passing it to functions; as in <code>C</code> arrays are passed by reference (with the exception of the <code>sizeof</code> operator).</p>
  
  <p>Here comes the point which makes me dangle. Have a look at the following piece of code:</p>
  
  <pre><code>int main()
  {
      int (*p)[3];
      int a[3] = { 5, 4, 6 };
  
      p = &amp;a;
  
      printf("a:%d\t&amp;a:%d\n",a,&amp;a);
      printf("%d",*(*p + 2));
  }
  </code></pre>
  
  <p><strong>OUTPUT:</strong></p>
  
  <pre><code>a:2686720       &amp;a:2686720
  6
  </code></pre>
  
  <p>So, how does the above code work? I have two questions:</p>
  
  <ol>
  <li><code>a</code> and <code>&amp;a</code> have the same values. Why?</li>
  <li>What exactly does <code>int (*p)[3];</code> do? It declares a <strong>pointer to an array</strong>, I know this. But how is a <strong>pointer to an array</strong> different from the <strong>pointer to the first element of the array</strong> and <strong>name of the array</strong>?</li>
  </ol>
  
  <p>Can anyone clarify things up? I am having a hell of a lot of confusions.</p>
  
  <p>I know that I should use <code>%p</code> as a placeholder instead of using <code>%d</code> for printing the value of pointer variables. As using the integer placeholder might print truncated addresses. But I just want to keep things simple.</p>