I am trying to sort x, y coordinates and am able to sort x column but not without losing the original y coordinate. How do I sort the x column while leaving the y coordinate intact with the x coordinate? Below is my function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void s(int m[][2], int numRows)
{
for (int i = 0; i < numRows; i++)
{
for (int j = 0; j < numRows -1; j++)
{
if (m[j][0] > m[j + 1][0])
{
int temp = m[j + 1][0];
m[j+1][0] = m[j][0];
m[j][0] = temp;
}
}
}
}