Union, like structure, contain members whose individual data type may differ to each other.
But the members that compose a union share the same storage area within the computer's memory, whereas each member within a structure is assigned its own unique storage area.
Thus, union are used to conserve memory.
1. Unions are useful for application involving multiple members, where value need not to be assigned to all of the members at any one time.
2. Unions are useful whenever there is a requirement to access the same memory location in more than one way. etc.
But the members that compose a union share the same storage area within the computer's memory, whereas each member within a structure is assigned its own unique storage area.
Thus, union are used to conserve memory.
1. Unions are useful for application involving multiple members, where value need not to be assigned to all of the members at any one time.
2. Unions are useful whenever there is a requirement to access the same memory location in more than one way. etc.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Post a Comment