title: Question about quicksort with std::vector
body: <p>Below are some code I found from internet which is using integer array for input. It is working well but if I change array to vector, it just print the original input 95, 45, 48, 98, 1, 485, 65, 478, 1, 2325. Can anyone explain the reason of it happens and how to fix it?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  
  
              void printArray(vector&lt;int&gt; array, int n)
              {
                  for (int i = 0; i &lt; n; ++i)
                      cout &lt;&lt; array[i] &lt;&lt; endl;
              }
  
              void quickSort(vector&lt;int&gt; array, int low, int high)
              {
                  int i = low;
                  int j = high;
                  int pivot = array[(i + j) / 2];
                  int temp;
  
                  while (i &lt;= j)
                  {
                      while (array[i] &lt; pivot)
                          i++;
                      while (array[j] &gt; pivot)
                          j--;
                      if (i &lt;= j)
                      {
                          temp = array[i];
                          array[i] = array[j];
                          array[j] = temp;
                          i++;
                          j--;
                      }
                  }
                  if (j &gt; low)
                      quickSort(array, low, j);
                  if (i &lt; high)
                      quickSort(array, i, high);
              }
  
              int main()
              {
                  vector&lt;int&gt; array = {95, 45, 48, 98, 1, 485, 65, 478, 1, 2325};
                  int n = sizeof(array)/sizeof(array[0]);
  
                  cout &lt;&lt; "Before Quick Sort :" &lt;&lt; endl;
                  printArray(array, n);
  
                  quickSort(array, 0, n);
  
                  cout &lt;&lt; "After Quick Sort :" &lt;&lt; endl;
                  printArray(array, n);
                  return (0);
              }
  </code></pre>