73. Unions-I

Question.2

A developer extracts individual bytes from a 32-bit register value on a little-endian system:

union {
   uint32_t value;
   uint8_t bytes[4];
} reg;

reg.value = 0x12345678;
printf("%02X %02X %02X %02X", reg.bytes[0], reg.bytes[1], reg.bytes[2], reg.bytes[3]);

What is the output?

Need Help? Refer to the Quick Guide below

Select Answer

Restart quiz!