How to print binary number via printf [duplicate]
Although ANSI C does not have this mechanism, it is possible to use itoa() as a shortcut:
char buffer [33]; itoa (i,buffer,2); printf ("binary: %s\n",buffer);
Here's the origin:
It is non-standard C, but K&R mentioned the implementation in the C book, so it should be quite common. It should be in stdlib.h.