Union in C programming allows the user to store different data types on the one location of memory, a union can defined by using different members, but a single member will be assigned a memory at a single time. Unions allow the user the proficiency to use single memory point for of different members.
In ANSI C, only first named member of the union can be initialized.
To define a union, the methodology is same as you used for structure, will also be used to define a union. A new data type will be defined for more than one member when you define a statement for union.
Union Tag: This can be use as an optional for defining the variable otherwise every it will be a normal variable definition, before ending the union definition you can define more variable while using before semi colon but it is optional.
Data type: when we use a variable for data type that data type can store any type character like floating points, integer etc .This means that we are using a single memory location for single variable but for different types of character. When we define a union it will grab the maximum size in memory to keep holding the largest member in the union. While defining the program for union you will define the character memory space which can occupied by a string of character.
Accessing union member: The operator for member access can be used for accessing the member of a union which is (.). The union operator is coded between the member that we want to access and the name of the union variable. The keyword Union is used to define the types of variables used in union.
So we it can be seen that we can we can define the union for different types of characters while using the same memory location.