title: Recursive Sort Function
body: <p>I've written a program to recursively sort an array. 
  However, I get the following error on line 11: syntax error before ']' token.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>//This program recursively sorts an array
  
  #include&lt;stdio.h&gt;
  
  void rec_sort(int values[], int n); 
  
  main()
  {
      int vals[4];
      vals[0] = 37; vals[1] = 48; vals[2] = 56; vals[3] = 63;
      printf("this array sorted: %x\n", rec_sort(vals[], 4));
  
      system("Pause"); 
      return 0;
  }
  
  void rec_sort(int values[], int n) {
  //Base case
  if (n&lt;2) return;
  
  int maxIndex=0;
  int i;
  
  //Find max item in array in indexes 0 through n-1
  for(i=1; i&lt;n;i++) {
        if(values[i] &gt; values[maxIndex])
           maxIndex=i;
  
      }
  
      //Swap this element with one stored in n-1
      //Set temp to n-1, set n-1 in array to max, set max to temp
      int temp = values[n-1]; //Store temp as last element in array
      values[n-1] = values[maxIndex]; //Store last element as max value in array
      values[maxIndex] = temp; //temp will keep on changing, as array is sorted
  
      //Recursively sort the array values of length n-1
      sort(values, n-1); 
  }
  </code></pre>