fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int isLE() {
  5. union { int i; char c; } x = { 1 };
  6. return x.c;
  7. }
  8.  
  9. int main()
  10. {
  11. printf("System is %s Endian\n", isLE() ? "Little" : "Big");
  12. return 0;
  13. }
Success #stdin #stdout 0s 5276KB
stdin
123
stdout
System is Little Endian