fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. int main()
  5. {
  6. uint64_t a = 0x8877665544332211;
  7. uint32_t b = (uint32_t)a;
  8. printf("%x\n", b);
  9. int i = 1;
  10. if (*((char *)&i) == 1) puts("little endian");
  11. else puts("big endian");
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0.01s 5280KB
stdin
123
stdout
44332211
little endian