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
You are calculating the result correctly, but you are not printing it right. Also you do not need a second loop:
for(;i
If you'd like to show off, you could replace the conditional with two exclamation points:
printf("%u ", !!(num&maxPow));