1 test case is not passed

#include
using namespace std;
void primes(int p,int b)
{
for( int i=2 ;i<=b;i++)
{
p[i]=1;
}
for(int i=2;i<=b;i++)
{
if(p[i])
{
for( int j=i
i;j<=b;j+=i)
{
p[j]=0;
}
}
}
p[1]=0;
p[0]=0;
return;
}
int main()
{
int t;
cin>>t;
for(int k=0;k<t;k++)
{
int a,b;
cin>>a>>b;
int cnt=0;
int*p=new int [1000000];
primes(p,b);
for(int i=a;i<=b;i++)
{
if(p[i]==1)
{
cnt++;
}
}
cout<<cnt<<endl;
}
return 0;
}

this is not correct approach
Your mistakes
you are calling prime function in every testcase which will not optimized

just calculate sieve array once
and in every testcase just count the no of prime nums

Correct Approach