title: Get the sorted indices of an array using quicksort
body: <p>I have changed to quicksort code to sort an array of floats which I got from <strong>tutorialgatway.org</strong>. However I need the sorted indices. I am aware of the <code>qsort</code> library function that can be used to get the sorted indices and I can implement that. However, I want to avoid standard library (I know this is not recommendation). The reason for not using a standard library is that I need to sort large number of arrays in a loop, which I need to parallelize using <code>openMP</code>, therefore writing function explicitly would allow me to parallelize quicksort function in a loop.</p>
  
  <pre><code>/* C Program for Quick Sort */
  #include &lt;stdio.h&gt;
  
  void Swap(float *x, float *y) {
      float Temp;
      Temp = *x;
      *x = *y;
      *y = Temp;
  }
  
  void quickSort(float a[], int first, int last) {
      int i, j;
      int pivot;
      if (first &lt; last) {
          pivot = first;
          i = first;
          j = last;
          while (i &lt; j) {
              while (a[i] &lt;= a[pivot] &amp;&amp; i &lt; last)
                  i++;
              while (a[j] &gt; a[pivot])
                  j--;
              if (i &lt; j) {
                  Swap(&amp;a[i], &amp;a[j]);
              }
          }
          Swap(&amp;a[pivot], &amp;a[j]);
          quickSort(a, first, j - 1);
          quickSort(a, j + 1, last);
      }
  }
  
  int main() {
      int number, i;
      float a[100];
      printf("\n Please Enter the total Number of Elements  :  ");
      scanf("%d", &amp;number);
      printf("\n Please Enter the Array Elements  :  ");
      for (i = 0; i &lt; number; i++)
          scanf("%f", &amp;a[i]);
  
      quickSort(a, 0, number - 1);
      printf("\n Selection Sort Result : ");
      for (i = 0; i &lt; number; i++)  {
          printf(" %f \t", a[i]);
      }
      printf("\n");
      return 0;
  }
  </code></pre>
  
  <p>How can I return the sorted indices in the code ?                                                                                                                                                                                                                                                 </p>