here is my code : https://ide.codingblocks.com/s/237368
its giving segmentation fault . please help
if you have to store only 0 and 1 why you are making integer array
after making bool array your code will run
as bool takes only 1byte and int takes 4 byte
but for passing all testcases you have to do something more
The 5,000,000th prime is 86,028,121.
size of array is very large
so rather than int use bool arr[100000001]={};
so atleast this much space you require
you can take help from this if needed
sorry sir i could not get it. why should we use bool instead of int.
if reason is that you have to store only 0 and 1 so what is need of int best is to store in bool
second reason is memory
int take 4 bytes while bool takes only 1 byte
hence using bool chances of segmentation fault and TLE reduces