I'm not looking for a solution here, I've found plenty on Google. I'm looking for an explanation.
While playing with arrays I found that declaring a 2D array dynamically doesn't work like expected
1D Array, Works
int main()
{
int rows;
int* pointer;
pointer = new int[rows];
}
2D Array, Doesn't Work
int main()
{
int rows;
int columns;
int* pointer;
pointer = new int[rows][columns]; //error on this line
}
This seems to me like the intuitive way of doing things because that's how its done with regular arrays, but apparently its incorrect and won't compile.
I haven't been able to find a clear explanation of WHY this is the case, hopefully someone here can enlighten me.
Thanks :)