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.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With