fork download
  1. #include <cstdio>
  2.  
  3. int main()
  4. {
  5. volatile int x = 0x1234ABCD;
  6. const unsigned char *p = (unsigned char *)&x;
  7.  
  8. printf("%0*X\n", sizeof(int) << 1, x);
  9.  
  10. for (unsigned q=0; q<sizeof(int); ++q)
  11. printf("%02X", p[q]);
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
1234ABCD
CDAB3412