title: keeping track of the original indices of an array after sorting in C
body: <p>I have an array let's say <code>A[5]</code>, the 5 elements are <code>5,4,1,2,3</code>. Now I sort these arrays in ascending order. so the resulting array will now be <code>1,2,3,4,5</code>. I use <code>qsort()</code> function of <code>stdlib.h</code> to sort this. The question is how can I get the indices of the original array with respect to my new array. originally my indices were <code>0,1,2,3,4</code> for corresponding values of <code>5,4,1,2,3</code> and now the indices have changed to 2,3,4,1,0. How can I get these indices efficiently in C? Thank you in advance(please write the code if possible)</p>