Right now, what I do is this:
void print_bits(unsigned int x)
{
int i;
for(i=WORD_SIZE-1; i>=0; i--) {
(x & (1 << i)) ? putchar('1') : putchar('0');
}
printf("\n");
}
Also, it would be great to have a solution independent of word size (currently set to 32 in my example).