This is stored on the stack.
Code:
int main ( ) {
int prime[MAX] = {0}, i, j;
//// more code
return 0;
}
This isn't stored on the stack.
Code:
static int prime[MAX] = {0}, i, j;
//// more code
return 0;
It's not a C issue, but most implementations restrict the amount of stack space given to each process.
For most desktop systems, the default stack size is somewhere between 1 and 8MB.
> So is there any way to increase the capacity? If not, what other methods can I use?
Using an int to store only 0 or 1 is very space inefficient.
You could try an array of unsigned chars instead.