Please tell me how do I print a bit, like printf(\"%d\",bit);.
printf(\"%d\",bit);
The C++ answer is easier than the C89 one, with the native bool type:
bool b = true; std::cout << b;
C99 is quite similar:
_Bool b = 1; printf("%d", b);