Array-bubble sort

#include
#include
using namespace std;

void bubble_sort(long long int a[],unsigned long int n)
{
long int itr,j;
for(itr=1;itr<=n-1;itr++)
{
for(j=0;j<=(n-itr-1);j++)
{
if(a[j]>a[j+1])
swap(a[j],a[j+1]);
}
}
}
int main() {
unsigned long int n,i;
long long int a[1000000];
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
bubble_sort(a,n);
for(i=0;i<n;i++)
cout<<a[i]<<" ";
return 0;
}

The condition for n was given that it has to be positive and array varies between -100000000 to 100000000.
So,according to that I specified the conditions but still I am getting error that all test cases are not matched although the code was successfully complied.

Hello @shubhangis248 define your array like this long long int a[100000005] .
Try like this and then reply here whether it passes the the test case or not

It is showing the same segmentation fault.

hello @shubhangis248 i have made changes in your code .
now it is working fine .


i hope i have cleared your doubt .
Happy Learning !!