Stack smashing error

On execution of given code ,i get an error of stack smashing .so please help me to understand what is it and how to resolve it .-------------------------------------------
CODE

#include
using namespace std;
#define l long long
l prime(l p,l n,l m)
{
if(n==1) return(2);
for(l i=3;i<=m;i+=2) p[i]=1;
p[0]=0;p[1]=0,p[2]=1;
l i=0,j=0,temp=1,no=0;
for(i=3;i<=m;i+=2)
{
if(p[i])
{
for(j=i
i;j<=m;j+=2*i )
{
p[j]=0;
}
temp++;
if(temp==n){
no=i;
break;}
}

}

return(no);

}
int main() {
l p[5000001]={0};
l m=5000001;
l n;
cin>>n;
cout<<prime(p,n,m);
return 0;
}

Plz send the code by saving on ide only.