Last active
July 11, 2023 15:48
-
-
Save mbs0221/2f4418ac92fae8a198b0c03e1a2b35ca to your computer and use it in GitHub Desktop.
endian.c
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
| #include <stdio.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| union w { | |
| int a; | |
| char b; | |
| } c; | |
| c.a = 1; | |
| printf("This cpu is %s\n", c.b == 1 ? "little-endian" : "big-endian"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment