58. Byte Splitter Union Basics

 Your task is to define a union ByteSplitter that allows viewing a 16-bit number both as a whole word and as two separate bytes.

  • The union should contain:
    • uint16_t word
    • uint8_t bytes[2]
  • The program will assign a value to the union and then print the low byte and high byte.
     

Example
 Input:

4660

Output:

LSB=52 MSB=18

 

Explanation: 

4660 = 0x1234, 

so LSB = 0x34 = 52, 

MSB = 0x12 = 18.

Loading...

Input

4660

Expected Output

LSB=52 MSB=18