Skip to content

Instantly share code, notes, and snippets.

@FreedomBen
Last active February 20, 2021 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FreedomBen/a12206b1e0609528af65762131c518b6 to your computer and use it in GitHub Desktop.
Save FreedomBen/a12206b1e0609528af65762131c518b6 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
int n = 1;
// little endian if true
if(*(char *)&n == 1) {
printf("Little endian\n");
} else {
printf("Big endian\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment