Weird, very weird case. Consider the code:
int n = 50;
auto p1 = new double[n][5]; //OK
auto p2 = new double[5][n]; //Error
main.cpp: In function ‘int main()’:
main.cpp:17:26: error: array size in new-expression must be constant
auto p2 = new double[5][n]; //Errormain.cpp:17:26: error: the value of ‘n’ is not usable in a constant expression
main.cpp:15:8: note: ‘int n’ is not const
Can anyone explain why do I get a compile error on the second one but the first one works perfectly?