fork download
  1. #include <stdio.h>
  2. #include <inttypes.h>
  3. #include <string.h>
  4.  
  5. int main(void)
  6. {
  7. float a = 1.0f;
  8. double b = a;
  9.  
  10. uint32_t a32, b32;
  11. uint64_t b64;
  12.  
  13. memcpy(&a32, &a, sizeof(a32));
  14. memcpy(&b64, &b, sizeof(b64));
  15. memcpy(&b32, &b, sizeof(b32));
  16.  
  17. printf("a32 = %" PRIu32 "\n", a32);
  18. printf("b64 = %" PRIu64 "\n", b64);
  19. printf("b32 = %" PRIu32 "\n", b32);
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 4532KB
stdin
Standard input is empty
stdout
a32 = 1065353216
b64 = 4607182418800017408
b32 = 0