If I want to sort the second dimension's 0 element like that:
short arr[5];
arr[0][0] = 122;
arr[0][1] = 33;
arr[0][2] = 45;
arr[1][0] = 33;
arr[1][1] = 12;
arr[1][2] = 42;
.
.
.
It will sort arr[i][0], but arr[i][1] and arr[i][2] will come with arr[i][0] to a new element.
vector<>rather than a C-style array - then you can just apply thesortmethod. If you must use C-style arrays for some reason then useqsort()fromcstdlibto sort.sortis a generic non-member function algorithm. It can be used with an array just as easily as it can be used with avector.