Prateek loves candy doubt

I have a doubt in my code.
The code https://ide.codingblocks.com/s/269131 works perfectly fine if I declare primes[1000000] array global, otherwise, it shows core dumped.
Not able to understand why

hello @pgarg
because global scope has some higher memory capacity than function scope.

But then what about the other array p.
It is not declared global

it depends on capacity and whether it is capable to store two array or not.
if m1 memory is required of 1st array and m2 is requirement of 2nd array then
m1 + m2 < stack capacity (then no need to decclare)
m1 + m2 > stack capacity but m1 <stack capacity then u can declare one as global and other as stacking.

oh got it.
And one last que
what is general stack capacity

i dont know.
array of size 10^6 works fine in function .

Okay. Thank you @aman212yadav

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.