title: Error message when sending an array to a function
body: <p>I am writing a function with the purpose of swapping the first and last elements in an array, and a main function to test it. The code is as follows:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  //function a
  firsttolast (int x[], int size)
  {
      int temp1;
      int temp2;
      temp1 = x[0];
      temp2 = x[(size - 1)];
      x[0] = temp2;
      x[(size - 1)] = temp1;
  }
  
  int main()
  {
      int X = 10;
      int array[10];
      cout &lt;&lt; "Please enter " &lt;&lt; X &lt;&lt; " integer elements of an array." &lt;&lt; endl;
      for (int i = 0; i &lt; X; ++i)
      {
          cin &gt;&gt; array[i];
      }
      firsttolast (array[10], X);
      for (int i = 0; i &lt; X; ++i)
          cout &lt;&lt; array[i] &lt;&lt; endl;
  }
  </code></pre>
  
  <p>The error is in this line:</p>
  
  <pre><code>firsttolast (array[10],X);
  </code></pre>
  
  <p>And is as follows:</p>
  
  <pre><code>[Error] invalid conversion from 'int' to 'int*' [-fpermissive]
  
  [Error] initializing argument 1 of 'double firsttolast(int*, int)' [-fpermissive]
  </code></pre>