title: When we pass an array to a function, how does the copy work?
body: <p>I read in the K&amp;R C book that when we pass an array to a function, the address of the array (a pointer containing the address of the first element of the array) is passed to the function, therefore making it seem like a pass-by-reference (although there is no such real mechanism in C)</p>
  
  <p>However, the below doesn't make sense to me then - </p>
  
  <pre><code>void test(char arr[10]) {
      arr[2] = 'a';
   }
  
   main() {
       char arr[5] = "hello";
       test(arr);
       printf("%s", arr);
       return 0;
   }
  </code></pre>
  
  <p>This gives me healo as expected.</p>
  
  <p>But does that mean that this is how this is evaluated?</p>
  
  <p>The "char arr[]" argument getting assigned the pointer to the actual array? How does that work?</p>
  
  <pre><code>char arr[10] = &amp;arr[0] 
  </code></pre>
  
  <p>doesn't make sense to me!</p>