The Operator new With Arrays
Go Up to The new And delete Operators Index
When using the array form of operator
new(), the pointer returned points to the first element of the array. When creating multidimensional arrays with new, all array sizes must be supplied (although the leftmost dimension doesn't have to be a compile-time constant):
mat_ptr = new int; // OK mat_ptr = new int[n]; // OK mat_ptr = new int; // illegal mat_ptr = new int; // illegal
Although the first array dimension can be a variable, all following dimensions must be constants.