Regarding Error

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<n;i++)
cin>>a[i];
ll ans=-1000000001;
for(ll i=0;i<n;i++)
{
ans=max(ans,a[i]);
}
cout<<ans<<"\n";
return 0;
}

/bin/run.sh: line 4: 17 Bus error (core dumped) ./exe

@lcs2019022
Your code is correct just submitted it directly.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.