Reducing memory usage when designing a sieve of eratosthenes in C
问题 I'm trying to design a sieve of eratosthenes in C but I've run into two strange problems which I can't figure out. Here's my basic program outline. Ask users to set a range to display primes from. If the range minimum is below 9, set the minimum as 9. Fill an array with all odd numbers in the range. 1) I'm trying to reduce memory usage by declaring variable size arrays like so: if (max<=UINT_MAX) unsigned int range[(max-min)/2]; else if (max<=ULONG_MAX) unsigned long int range[(max-min)/2];