#include using namespace std; int main(){ int n=10; int a[n]; for (int i=0; i
That is C99 feature that allows VLA (variable length array).
Compile it with g++ -pedantic, I'm sure that wouldn't compile.
g++ -pedantic
This a a C99 feature called VLA which some compilers also allow in C++. It's allocation on stack, just as it would be with int a[10].
int a[10]