Well you could actually sort a 2d array, but if that's too difficult to figure out--
make an array with positions in them first:
Code:
int positions[N] = {0, 1, 2, 3, ... N - 1 };
This is what you're going to sort. In other words, you need to arrange it such that position[N - 1] for example will give you the index (by column or by row depending on the arrangement) of the lowest grade, and you ignore that one. To sort positions you only need to change how the comparison and swap is written. It depends on which dimension grades will be in, but you would compare:
Code:
if ( students[x][ positions[y] ] > students[x][ positions[ y+1 ] ] )
And then you don't swap all of students[x] and students[ x+1 ] but positions[y] and positions[ y+1 ].
And then you use the positions array to find out which grades to ignore because it will give you the appropriate index in the unsorted students 2d array.