How to sort a 2D character array in lexicographical order in C? : <p>I want to sort a 2D array in lexicographical order.</p>

<p>Suppose the given 2D array is </p>

<pre><code>ebacd
fghij
olmkn
trpqs
xywuv
</code></pre>

<p>Now after arranging it in lexicographical order the array 2D array will be</p>

<pre><code>abcde
fghij
klmno
pqrst
uvwxy
</code></pre>

<p>Please provide me a logic so that I can get solve this problem. Provided number of rows and columns of the array will be same.</p>
