73. Unions-I

Question.6

A developer defines a union for a 5-byte communication packet:

typedef union {
   struct {
       uint8_t header;
       uint32_t payload;
   } fields;
   uint8_t raw[5];
} Packet;

printf("%lu", sizeof(Packet));

The developer expects sizeof(Packet) to be 5. What does it actually print?

Need Help? Refer to the Quick Guide below

Select Answer

Restart quiz!