52. Union Extract Bytes from a 32-bit Value

Your task is to:

  • Use a union that overlays a uint32_t value with a 4-byte uint8_t array
  • Read a 32-bit unsigned integer input
  • Print its 4 individual bytes in little-endian order (i.e., LSB first)

Use only union access, no bit masking or shifts.


Example-1

Input: 305419896
Output: 120 86 52 18

(0x12345678 → bytes: 0x78 0x56 0x34 0x12)


Example-2

Input: 4294967295
Output: 255 255 255 255


Example-3

Input: 1
Output: 1 0 0 0


 

Loading...

Input

305419896

Expected Output

120 86 52 18