Created
August 29, 2020 12:20
-
-
Save wukaihua119/cb4c7a0872cc3d7704fe58604f2a6059 to your computer and use it in GitHub Desktop.
Revisions
-
wukaihua119 created this gist
Aug 29, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ // using mask to convert the integer to binary. void printBin( int num ){ int mask = 1 << 7; // 10000000 for( int i = 0; i < 8; ++i ){ printf( "%d", ((( num & mask ) == 0 )? 0:1) ); mask >>= 1; } printf( "\n" ); }