So I'm trying to implement the sieve of Erastothenes using a bit array in C. I've tried manually setting the bits using
int x;
int i;
x = x | (1 << i); // Set bit position i in x
However, I realized this will be too much iterations when I'm doing 10,000 iterations. If I use a 32-bit unsigned int array for my bit array, how do I initialize all 32 bits at once?
I tried setting
unsigned int[] arr = { [0-100000] = 1 };
that obviously didn't work.
Set the value of the 32bit unsigned int to 4294967295 or, if the number is a signed 32bit int set it to -1
11111111111111111111111111111111 <- 32 1's I used this site to convert it to decimal. https://www.rapidtables.com/convert/number/binary-to-decimal.html