title: Reverse array with recursion in C programming
body: <p>I was having some problem when trying to do a reverse array using recursion. Here is the function prototype:</p>
  
  <pre><code>void rReverseAr(int ar[ ], int size); 
  </code></pre>
  
  <p>And here is my code:</p>
  
  <pre><code>int main()
  {
      int ar[10], size, i;
  
      printf("Enter array size: ");
      scanf("%d", &amp;size);
      printf("Enter %d numbers: ", size);
      for (i = 0; i&lt;size; i++)
          scanf("%d", &amp;ar[i]);
      rReverseAr(ar, size);
      printf("rReverseAr(): ");
      for (i = 0; i&lt;size; i++)
          printf("%d ", ar[i]);
      return 0;
  }
  
  void rReverseAr(int ar[], int size) {
      int start = 0, end = size - 1, temp;
      if (start &lt; end) {
          temp = ar[start];
          ar[start] = ar[end];
          ar[end] = temp;
          start++;
          end--;
  
          rReverseAr(ar, size - 1);
      }       
  }
  </code></pre>
  
  <p>The expected output should be when user entered <code>1 2 3</code> and it supposed to return <code>3 2 1</code>. However, with these code, the output that I am getting is <code>2 3 1</code>. </p>
  
  <p>Any ideas?</p>