I read on GeeksforGeeks that arrays in C++ are statically allocated memory i.e. at the compile time. Whereas Vectors in C++ are allocated memory dynamically.
E.g.
vector<int> vec;
vec.push_back(1);
But I have some doubt in this. Like if I declare array like :->
int n;
cin>>n;
int arr[n];
How can this be statically allocated because at runtime only we will provide the value for n and then only memory will get allocated. Shouldn’t this come under dynamic allocation?