Special sorting function of a 2D array in C

Job ID: 34930073

Budget: $10 – $30 USD

I need a C (not C++) function to sort a 2D array with dimensions NxM with integer as follows:
Sample Input:
11,21,11,10
8,21,13,7
7,10,11,14
11,31,15,4
5,14,15,17
13,11,12,29
Output:
4, 11,15,31
5,14,15,17
7,8,13,21
7,10,11,14
10,11,11,21
11,12,13, 29

That is - first sort each row, then sort by columns like in a dictionary but considering the weights of the numbers.

Must only use standard libraries.
Related categories: C Programming C++ Programming