Having variable for array index in C/C++

Hi there, can explain if this code is allowed?

int n;
int arr[n];

Usually need a const for array index size. Anyhow it working for some code without errors.