I have been working on C++ and I was recently told that I was making 2D arrays on the heap wrong. I have always done it this way:
int **array1 = new int*[200];
for (int i = 0; i < 200; ++i)
{
array1[i] = new int[200];
}
I was told that this was the better way:
int(*ptr)[200] = new int[200][200];
However the person explaining it to me was not able to explain it well as to why one is better then the other. I was hoping someone here would tell me why one would be better then the other?