Skip to content
RED SAG Skills
medium10 pts · first answer countsembedded-cmemory-layout

Reading bytes of a value via a union

Is it valid C to write u.word and then read u.bytes[0] in this union?

union { uint32_t word; uint8_t bytes[4]; } u;
u.word = 0x11223344u;
uint8_t first = u.bytes[0];
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions