print binary c

Solutions on MaxInterview for print binary c by the best coders in the world

showing results for - "print binary c"
Allan
30 May 2018
1// Note that u can change this function to print int values
2// by changing the type and the sizeof 
3void print_bin(unsigned char value)
4{
5    for (int i = sizeof(char) * 7; i >= 0; i--)
6        printf("%d", (value & (1 << i)) >> i );
7    putc('\n', stdout);
8}
Julieta
15 Nov 2019
1// Note that u can change this function to print int values
2// by changing the type and the sizeof
3void print_bin(unsigned char value)
4{
5    for (int i = sizeof(char) * 8; i != -1; i--)
6        printf("%d", (value & (1 << i)) >> i );
7    putc('\n', stdout);
8}