while solving problem, Sorting two dimensional arrays was needed. I used merge sort, and set

```
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
using namespace std;
int*sorted[1000];
void merge(int** list, int left, int mid, int right);
void merge_sort(int** list, int left, int right);
int main(void) {
int N;
vector <int> L, H;
int l, h, max = 0, max_position, highest, highest_position = 0, area = 0; cin >> N;
int** info = (int**)malloc(sizeof(int*) * N);
for (int i = 0; i < N; i++) {
info[i] = (int*)malloc(sizeof(int) * 2);
}
}
merge_sort(info, 0, N - 1);
}
void merge(int** list, int left, int mid, int right) {
int i, j, k, l;
i = left; j = mid + 1; k = left;
for (int s = 0; s < 7; s++) {
for (int v = 0; v < 2; v++) {
cout << list[s][v] << ' ';
}
cout << 'n';
}
while (i <= mid && j <= right) {
if (list[i][1] <= list[j][1]) // exception occured
{
sorted[k++] = list[i++];
}
else {
sorted[k++] = list[j++];
}
}
if (i > mid) // 1번째 array를 다 쓴 경우
{
for (l = j; l <= right; l++) {
sorted[k++] = list[l];
}
}
else {
for (l = i; l <= mid; l++) {
sorted[k++] = list[l];
}
}
for (l = left; l <= right; l++) {
list[l] = sorted[k]; // I think problem is related with this line
}
}
void merge_sort(int** list, int left, int right) {
int mid;
if (left < right) {
mid = (left + right) / 2;
merge_sort(list, left, mid);
merge_sort(list, mid + 1, right);
merge(list, left, mid, right);
}
}
```

I assigned sorted array which is needed while sorting as interger pointer array, because I thought I need to assign addressees of each rows of the two dimensional array.

But problem seems to say that my basic thought related with pointer is wrong. Does anyone can help me with this?

Source: Windows Questions C++