• Union and structure are two secondary data types in C which are sued to represent and entity in database.
• Although the syntax of union and structure is very much similar, the purpose of both is different.
• Structure is a set of heterogeneous data elements stored in successive memory locations whereas union is a set of heterogeneous data elements in which the storage of each element originate at the same location.
• Union is more memory economical than structure.
• Memory requirement of structure is the sum of memory requirement of all members whereas memory requirement of union is the memory of element that requires maximum memory.
• Union is mainly used when we need to use only member at a time, even if several members are declared.
• Although the syntax of union and structure is very much similar, the purpose of both is different.
• Structure is a set of heterogeneous data elements stored in successive memory locations whereas union is a set of heterogeneous data elements in which the storage of each element originate at the same location.
• Union is more memory economical than structure.
• Memory requirement of structure is the sum of memory requirement of all members whereas memory requirement of union is the memory of element that requires maximum memory.
• Union is mainly used when we need to use only member at a time, even if several members are declared.
No comments:
Post a Comment