I have seen that I can use a variable as the specification for the dimension of a one-dimensional array to be allocated by the "new" keyword. The book I'm reading explains that this can be extended to two or more dimensions but with a restriction, only the left-most dimension can be specified by a variable. All other dimensions must be constants or constant expressions. So I could write something like this:
int max = 0; // Number set by user at execution long* pBigArray = 0; // Pointer to big array pBigArray = new long[max]  ; // Multi-dimensional array
But I can't write this:
pBigArray = new long[max] [max] [max];
Can someone tell me why I can't write the above?
Is there a way to get around this? It seems like there should be a way to dynamically allow multi-dimensional arrays to be set. Like maybe somehow setting three one dimensional arrays dynamically and then use them to form a multi-dimensional array. If that is the case I still don't understand why you can't just set a multi-dimensional array to begin with.
The error I get from my compiler when I try to do the above is:
"error C2440: '=' : cannot convert from 'long (*)' to 'long *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast"