fork(2) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. double d = (double)1/3;
  5.  
  6. unsigned char *x = (unsigned char *)&d;
  7. printf("chars: %2x%2x %2x%2x %2x%2x %2x%2x\n",
  8. x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]);
  9.  
  10. // as per Yu Hao's answer
  11. long long dd = *(long long*)&d;
  12. printf("lld : %8llx\n", dd);
  13.  
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
chars: adfa 5c6d 454a 9340
lld  : 40934a456d5cfaad