I am trying to write a program in C that prints bits of int. for some reason i get wrong values,
void printBits(unsigned int num){ unsigned int size = si
To address point two, I'd consider the following, which is simplified a bit for ease of understanding.
void printBits(unsigned int num) { for(int bit=0;bit<(sizeof(unsigned int) * 8); bit++) { printf("%i ", num & 0x01); num = num >> 1; } }