The code gives segmentation fault when n is initialized to 10^8
Hello @bhadra28
Dont declare that big size array instead find 500 000 th prime numbre and prepare ur sieve upto that.
i think the 500000th prime is of the order 10^8 so shouldnt i declare it that way?
also why doesnt it work when the array size is too large. thank you for your response 
The 500,000 th prime is 7,368,787. u can easily declare array of this size.
because of memory limit, larger size array consume more memory.
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.