Union
I am HKUST student and a Robotics team member at the same time.
Union
union: Data-type which stores data items with different types in the same memory location.
Sample Code
Output:
Note that prior to printing the data members, the final value set is "Robotics team"
to the char s[15]
member.
The result would be chaotic because all data members are stored in the same memory. The printed values will correspond to "Robotics team" in their own data type.
Last updated