Advertisement
teknoraver

LE BE

Apr 30th, 2015
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.     int i;
  7.     uint32_t x = 0xAABBCCDD;
  8.     uint8_t *p = (uint8_t *)&x;
  9.  
  10.     printf("x:  %08x\n", x);
  11.     for(i = 0; i < sizeof(x); i++)
  12.         printf("p[%d]:  %02x\n", i, p[i]);
  13.  
  14.     printf("Machine is %cE\n", p[0] == x >> 24 ? 'B' : 'L');
  15.  
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement