title: Sort an array by an index array in C
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7365814/in-place-array-reordering">In-place array reordering?</a>  </p>
  </blockquote>
  
  
  
  <p>I have <strong>original unsorted array</strong> with structures such as:</p>
  
  <pre><code>{D, A, B, E, C}
  </code></pre>
  
  <p>and <strong>array of indexes</strong> of original array in sorted order:</p>
  
  <pre><code>{2, 3, 5, 1, 4} // Edited. Then I get {A, B, C, D, E}.
  </code></pre>
  
  <p>How can I <strong>simply rearranged the originial array</strong> by an <strong>index array</strong>?</p>
  
  <p>I can't create new array and insert elements by index-position.</p>