#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n];
return 0;
}
here it wont let define the arr of size n the value of n is defined above so n is most propbably a constant right?
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n];
return 0;
}
here it wont let define the arr of size n the value of n is defined above so n is most propbably a constant right?
n is not a constant. In C++, n would only be a constant if it is defined as const int n.
If you're reading n from cin with cin >> n, then how can it be a constant? You can't control what the user inputs.