Union in C
Unions are conceptually similar to structures. The syntax to declare/define a union is also similar to that of a structure.
The only differences are in terms of storage. In structure each member has its own storage location, whereas all members of union uses a single shared memory location which is equal to the size of its largest data member.
This implies that although a union may contain many members of different types, it cannot handle all the members at the same time. A union is declared using the
union
keyword.
No comments:
Post a Comment