c - How do I print the binarys of a hex? -
for example 0x19 00011001 in binary. tried using printf %08x, gives me 00000019 output. how print 00011001 instead?
for (i=0; i<32; i++) putchar((x&(1<<(31-i)))?'1':'0');
for example 0x19 00011001 in binary. tried using printf %08x, gives me 00000019 output. how print 00011001 instead?
for (i=0; i<32; i++) putchar((x&(1<<(31-i)))?'1':'0');
Comments
Post a Comment