I am trying to write a program to determine all prime numbers below an assigned value and it returns stack overload. The last part of my code is also telling if the number of primes is a prime number. Same for the number of lines of primes.
If you are finding the primes less than 441181 why are you adding ten instead of 1 (take into account the 0)? Also you may not have enough memory in the stack. Try creating it on the heap(pointer and new) or in the global space(above main). Another thing I would suggest is to use std::vector<bool> for prime sieves as it takes up about 1/8 the memory. Basically instead of the booleans being 1 byte each (8 bits) like a character they are used as 1 bit. Of course it has to reserve by bytes and not bits so if you have 1-7 it will still take up 8 bits/1byte. But instead of using 8 bytes for 8 booleans you are only using 1 byte. http://www.cplusplus.com/reference/vector/vector-bool/