59. Float to Bytes Type Punning

Your task is to define a union that allows viewing a float both as a floating-point number and as its raw 4-byte representation.

  • The union should contain:
    • float f
    • uint8_t bytes[4]

The program will assign a value to the union and then print the raw bytes.
 

Example
 Input:

1.0

Output :

00 00 80 3F

 

Input:

-2.5

Output :

00 00 20 C0
Loading...

Input

1

Expected Output

00 00 80 3F