Problem in challenge Deepak and Primes

My code https://ide.codingblocks.com/s/267779 is not getting compiled. showing segmentation fault.

maximum size of global array that can be defined is 10^7-10^8

if defined in local scope ( ie a function ) then max size is 10^6

so u need to update the vector /array size to 10000001

Still showing segmentation fault


added comments
also since the p and primes array just store no like 0 or 1 or N upto 10000001 so use datatype int instead of long long int

1 Like