Nth prime sieve

Failing all the test cases:

#include<bits/stdc++.h>
using namespace std;
#define ll long long
void prime_sieve(int p,int n)
{
for(ll i=3;i<=1000000;i+=2)
{
p[i]=1;
}
for(ll i=3;i<=1000000;i+=2)
{
if(p[i]==1)
{
for(ll j=i
i;j<=1000000;j+=i)
{
p[j]=0;
}
}
}
p[2]=1;
int nth=0,k=2;
while(nth<=n)
{
if(p[k]==1)
{
nth++;
}
k++;
}
cout<<nth<<endl;
return;
}

int main()
{
int n;
cin>>n;
int p[1000000]={0};
prime_sieve(p,n);

return 0;

}

Hello @brinda_dabhi could you please share your code by saving it on ide.codinglbocks.com .

check now:

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.