jweinst1
4/16/2020 - 7:47 AM

print_bits.c

static void print_bits(int bits, int newline)
{
    size_t tip = CHAR_BIT * sizeof(int);
    while (tip--) {
        putc( ((bits >> tip) & 1) ? '1' : '0' , stdout);
    }
    if(newline)
        putc('\n', stdout);
}