Created
April 14, 2022 02:47
-
-
Save omargfh/3ec4b980ab81bf53a844c149384be609 to your computer and use it in GitHub Desktop.
displayBits.c
This file contains 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 display(int val) { | |
for(int i = 0, s = sizeof(val) * 8; i < s; i++) { | |
if (!(i % 8) && i != 0) { | |
printf(" "); | |
} | |
printf("%d", (val >> (s - 1 - i)) & 0x01); | |
} | |
printf("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment