Answer the question
In order to leave comments, you need to log in
{} when initializing an array of arrays?
Why does this compile with -c++11:
int x=2, y=5;
int arr[x][y]{};
Answer the question
In order to leave comments, you need to log in
In general, it shouldn't compile at all. Array sizes must be constant expressions.
What you have is a compiler extension. Doesn't work in C++14, most likely because in C++11 the compiler uses its own extension based on C++ VLAs. And in C++14, there are more limited C++ ARBs that could have been included in C++14 but weren't.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question