about summary refs log blame commit diff stats
path: root/printf_binary.c
blob: b36dcc98a94d8f4b803d37e5a3b351fa57c679f2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                                       
#include <stdio.h>

void bp(char n){
    /* prints chars up to value 255 (for 255, the MSB is 2^7 == 128) */
    int i = 128;
    while (i) {
        printf("%c", ((n & i) == i) ? '1' : '0');
        i >>= 1;
    }
}