Answers for "print binary in c printf"

C
1

print binary c

// Note that u can change this function to print int values
// by changing the type and the sizeof 
void print_bin(unsigned char value)
{
    for (int i = sizeof(char) * 7; i >= 0; i--)
        printf("%d", (value & (1 << i)) >> i );
    putc('n', stdout);
}
Posted by: Guest on October-04-2021

Code answers related to "C"

Browse Popular Code Answers by Language