title: Sort floating point numbers in a 2D array in C++
body: <p>I came across <code>std:sort</code> but it wouldn't work in my case. I have a 2D float array wherein I need to sort just one column. Any sorting algo for FLOATS will do. I was thinking of Merge Sort, though. Anybody?</p>
  
  <pre><code>void selectionSort(float x[], int n) {
  float curr = 0, min = 0, i = 0, temp;
  
  for (curr = 0; curr &lt; n-1; curr++) {
      min = curr;  // assume this is smallest
  
      //--- Look over remaining elements to find smallest.
      for (i = curr+1; i &lt; n; i++) {
          if (x[i] &lt; x[min]) {
              //--- Remember index for latter swap.
              min = i;
          }
      }
  
      //--- Swap smallest remaining element
      temp = x[curr];
      x[curr] = x[min];
      x[min] = temp;
  }}
  </code></pre>
  
  <p>VS 2010 outputs an error: subscript is not of integral type</p>