This question already has an answer here:
- C++: Why does int array[size] work? 3 answers
#include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the size :";
cin>>n;
int array[n]; // I've worked some outputs and it works
return 0;
}
Is this some kind of dynamic allocation?
Why doesn't it even gives an error for 'n' to be a "const"?
Also, writing cout << array[n+5];
doesn't result in an compile time or runtime error.
I'm using Dev-C++.