What is the mistake?

#include<bits/stdc++.h>
using namespace std;
void bubble_sort(int *a,int n,int j)
{
if(n==1)
{
return ;
}
if(j==n-1)
{
bubble_sort(a,n-1,0);
}
if(a[j]>a[j+1])
{
swap(a[j],a[j+1]);
bubble_sort(a,n,j+1);
}
return ;
}
int main()
{
int n;
cin>>n;
int i,a[n];
for(i=0;i<n;i++)
cin>>a[i];
bubble_sort(a,n,0);
for(i=0;i<n;i++)
cout<<a[i]<<" ";
return 0;
}
what is the mistake in this code?, it is not giving correct o/p for all inputs

Hi @agarwalarjit.agarwal

There was a minor error. I have corrected it and you will be able to figure it out.
Link : https://ide.codingblocks.com/s/213379

Hope it Helps.