Long long int instead of int

in the second loop of prime_sieve function in the video, why is long long int required instead of simple int. Why does int show a segmentation fault when the code is run?

void prime_sieve(int *p){

for(int i=3; i<=1000000; i+=2){
		p[i] = 1;
}

//sieve
for(long long i=3; i<=1000000; i++){
	if( p[i] ==1){
		for(long long j=i*i; j<=1000000; j+=i){ 
			p[j] = 0;
		}
	}
}

p[2]=1;
p[1] = p[0] =0;

}

@Samarth_Shah because int can store only upto 1e9 and i*i will exceed that

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.