I'm a beginner in c++, and everything worked fine until a couple a days ago. I tried to run a code but it gave me this error: "ISO c++ forbids variable lenght array 'v' [-Wvla]" (I haven't modified anything from settings).
Here is the code:
#include <iostream>
using namespace std;
int n,i;
int main()
{
cin>>n;
int v[n];
for(i=0;i<n;i++)
{
v[i]=i;
}
for(i=0;i<n;i++)
{
cout<<v[i]<<' ';
}
}
Also, I've tried to run the program on the online compiler and it works ok. If I need to show you something just tell me.