C++ supporting user entered array size on stack memory

Viewed 50

I was surprised to see that below code works in C++.

int n;
cin >> n;
int arr[n];

which is violating most of the information available on internet in this context, that, array size should be compile time known. Is the above feature/behavior is universally rolled out and accepted, or it is just compiler dependent or C++ language version dependent?

0 Answers
Related