Created
May 20, 2014 06:40
-
-
Save yao2030/851fc9610fcdfd9355a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void to_binary(unsigned long n) | |
{ | |
int r; | |
r = n % 2; | |
if (n >= 2) | |
to_binary(n / 2); | |
putchar('0' + r); | |
} | |
// the gist is the last line of the function. '0' + r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment