The problem is your loop:
while (next_prime + 1 < MAXBYTES*8 && getBit(bit_arr, ++next_prime))
{
print_prime(next_prime);
}
Your keeping printing things while the bit is set (i.e. while you know it's not a prime). So basically, your loop is "print all the numbers I find while looking for the next prime" rather than "look for the next prime in a loop, then print the next prime".
I suspect you want something like:
next_prime++; // We always want to at least move on once...
while (next_prime + 1 < MAXBYTES*8 && getBit(bit_arr, next_prime))
{
next_prime++;
}
print_prime(next_prime);
I haven't checked whether that's all that was wrong with the code, but it's certainly an initial thing to fix.