📜  print binary - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:39.394000             🧑  作者: Mango

代码示例2
// 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) * 8; i != -1; i--)
        printf("%d", (value & (1 << i)) >> i );
    putc('\n', stdout);
}