title: Pass an array to a function by value
body: <p>Below is a snippet from the book <em>C Programming Just the FAQs</em>. Isn't this wrong as Arrays can never be passed by value?</p>
  
  <blockquote>
    <p><strong>VIII.6: How can you pass an array to a function by value?</strong>  </p>
    
    <p><strong>Answer:</strong> An array can be passed to a function by value by declaring in
    the called function the array name
    with square brackets (<code>[</code> and <code>]</code>)
    attached to the end. When calling the
    function, simply pass the address of
    the array (that is, the array’s name)
    to the called function. For instance,
    the following program passes the array
    <code>x[]</code> to the function named
    <code>byval_func()</code> by value:</p>
    
    <p>The <code>int[]</code> parameter tells the
    compiler that the <code>byval_func()</code>
    function will take one argument—an
    array of integers. When the
    <code>byval_func()</code> function is called, you
    pass the address of the array to
    <code>byval_func()</code>:  </p>
  
  <pre><code>byval_func(x);
  </code></pre>
    
    <p>Because the array is being passed by
    value, an exact copy of the array is
    made and placed on the stack. The
    called function then receives this
    copy of the array and can print it.
    Because the array passed to
    <code>byval_func()</code> is a copy of the
    original array, modifying the array
    within the <code>byval_func()</code> function has
    no effect on the original array.</p>
  </blockquote>