fork download
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. bool is_little(){
  4. int x = 1;
  5. char *ch = (char *)&x;
  6. if(ch[0] == 1) return 1;
  7. else return 0;
  8.  
  9. }
  10.  
  11. int main(){
  12.  
  13. if(is_little) printf("little endian");
  14. else printf("big endian");
  15. printf("Hi");
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
little endianHi