Converting a decimal integer to binary in C

posted on January 26, 2009

This is some C code that I wrote to convert a decimal integer to its binary equivalent. Most programs written to do so convert the decimal to a string, or an array, of the consecutive remainders modulo 2, which is then printed out in reverse order to get the binary equivalent. However I wanted an integer output of the binary equivalent. So this is what I did.