Is this a valid 2D Array definition in C++?
c++, multidimensional-array, pointers
Solution
This is valid syntax, but it doesn't specify 2D arrays. It's using the comma operator, so it's equivalent to:
int *p = new int[6];
p[3] = 5;
Problem
I just saw something like this in a C++ code (that compiles and probably works in VS2010): ``` int *p = new int[8, 6]; p[2, 3] = 5; ``` Is this a new notation for creating multidimensional arrays in C++? Or am I missing something? As far as I remember, arrays are declared this way [a][b] not [a, b] in C++. It would be highly appreciated if you could explain this code. Thanks.