title: When is an array name or a function name 'converted' into a pointer ? (in C)
body: <p><strong>1)</strong>  <em>Misconception</em> :</p>
  
  <ul>
  <li><p>Whenever an array is declared in C language, a pointer to the first element of the array is <em>created</em> (the name of the array) implicitly. <strong>(Is it? I don't think so!)</strong></p></li>
  <li><p>The first two lines of <a href="http://ee.hawaii.edu/~tep/EE160/Book/chap7/subsection2.1.3.2.html" rel="nofollow noreferrer">this</a> page (though I am not sure about the correctness of the information) state the same.</p>
  
  <p><s></p>
  
  <blockquote>
    <p>As we have seen, when we declare an array, a contiguous block of memory is allocated for the cells of the array and a pointer cell (of the appropriate type) is also allocated and initialized to point to the first cell of the array.
    </s></p>
  </blockquote></li>
  <li><p>But when I output the address contained <strong>in</strong> that pointer and the address <strong>of</strong> that pointer, they turn out to be the same.
  So, I think a pointer is not <em>created</em> after all.</p></li>
  </ul>
  
  <p><strong>2)</strong> I picked this up from <a href="https://stackoverflow.com/questions/1641957/is-array-name-a-pointer-in-c">this</a> question.  </p>
  
  <ul>
  <li><strong>In most cases array names are converted to pointers.</strong>  </li>
  </ul>
  
  <p>Can anyone give a detailed explanation of <strong>WHEN</strong> the compiler decides to <em>convert</em> an array name into a pointer, and <em>WHY</em>?  </p>
  
  <p>PS: Please explain the same with <em>functions</em>. Also in <a href="https://stackoverflow.com/questions/4295432/typedef-function-pointer">this</a> link, an example was given, saying that for a function <code>int square(int,int)</code>, any of the  <code>square</code>, <code>&amp;square</code>, <code>*square</code>, <code>**square</code> refers to the same function pointer. Can you explain?  </p>
  
  <p>Edit : Code snippet </p>
  
  <pre><code>int fruits[10];
  printf("Address IN constant pointer is %p\n",  fruits);
  printf("Address OF constant pointer is %p\n", &amp;fruits); 
  </code></pre>
  
  <p>Output :  </p>
  
  <pre><code>Address IN constant pointer is 0xbff99ca8
  Address OF constant pointer is 0xbff99ca8
  </code></pre>