I need check large integers (up to 10 million) for primality. My usual way is as follows:

But I get "Segmentation Fault: 11" when I declare MAX to be 10 million. I don't understand the theory, but I presume this error is related to array capacity in C. So is there any way to increase the capacity? If not, what other methods can I use?Code:int prime[MAX] = {0}, i, j; for(i=2;i<MAX;i++) prime[i] = 1; for(i=2;i<MAX;i++) for(j=i+i;j<MAX;j+=i) prime[j] = 0;