The memory allocated for the union is the size of the largest type in the union, which is in this case. Let's say the size of on your system is 2 bytes then So the first byte is and the second one is .(On Little endian systems) is one byte on all systems. So the access and is per byte access. I am just giving you how memory is allocated and the value is stored.You need to consider the below points since the output depends on them. PS: The memory occupied by both the members is the same in union.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile