I was trying to create 2D array in a continuous memory block, but it is giving M continuous block, each of N size.
int **arr = new int*[M];
for (int i = 0 ; i < M ; i++ )
{
arr[i] = new int[N];
}
How to create 2D array in a continuous memory block?
Actually it’s not necessary to store arr pointers – they can be calculated when needed.