Question: Hello, how would I sort a 2D array in C ? The rows need to stay together. Please work with this example: int disp[5][4] =

Hello, how would I sort a 2D array in C?

The rows need to stay together.

Please work with this example:

int disp[5][4] = { {10, 11, 12, 13}, {19, 15, 16, 17}, {11, 13, 12, 15}, {12, 13, 14, 17}, {14, 10, 12, 17} };

Let us say I want to sort each row based on the first column.

How would I sort this in C?

Please sort in ascending order.

PLEASE do all the sorting in 1 function for understandability.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!