Created
July 23, 2019 18:45
-
-
Save shriroopjoshi/c41ff784d073508f618e389e7d427bfe to your computer and use it in GitHub Desktop.
Code to check endian-ness of the system
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() { | |
| unsigned int i = 1; | |
| char *c = (char*) &i; | |
| if (*c) | |
| printf("Little endian\n"); | |
| else | |
| printf("Big endian\n"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment