Unions of structure in C language

-A union is a memory location that is shared by several variables of different data types in C programming language.

-Syntax:-
 union uniontag{
   datatype member 1;
   datatype member 2;
   ----
   ----
   datatype member n;
};

-Initialization and accessing:-
*Same syntax of structure is used to access a union member.

*The dot operator is for accessing members.

*The arrow operator ( ->) is used for accessing the members using pointer.
Posted on by