fork download
  1. #include <stdio.h>
  2.  
  3. unsigned int n1;
  4. int n2;
  5. float f3;
  6.  
  7. int main(void) {
  8.  
  9. n1 = 0xbdfcb924;
  10. n2 = 0xbdfcb924;
  11. f3 = 0xbdfcb924;
  12. //n1 = 0xffffffff;
  13. //n2 = 0xffffffff;
  14. //f3 = 0xffffffff;
  15.  
  16. printf("n1 = %x\n", *(unsigned int*)&n1); // hex放進去
  17. printf("n2 = %x\n", *(unsigned int*)&n2); // hex放進去
  18. printf("f3 = %x\n\n", *(unsigned int*)&f3); // 無號整數轉為浮點數放進去
  19.  
  20. printf("n1 = %d\n", n1); // hex放進去
  21. printf("n2 = %u\n", n2); // hex放進去
  22. printf("f3 = %f\n\n", f3); // 無號整數轉為浮點數放進去
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
n1 = bdfcb924
n2 = bdfcb924
f3 = 4f3dfcb9

n1 = -1107511004
n2 = 3187456292
f3 = 3187456256.000000