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.
This should help you :
http://www.cplusplus.com/reference/algorithm/sort/