Whats the problem in this its failing one test case is it correct to use long long int tye array

#include
#include
using namespace std;
int main() {

long long int n;
cin>>n;
long long int max=0;
 long long int a[n];
for(int i=0;i<n;i++)
{
   cin>>a[i];
}
for(int i=0;i<n;i++)
{
	if(a[i]>max)
	{
		max=a[i];
	}
}
cout<<max;
return 0;

}

hello @guptanikhil898
consider a case where all elements of ur array is negative,in that case u will print 0 which is wrong.

to rectify it initialise ur max with any value in array.