![]() At the end of the union's definition, before the final semicolon, you can specify one or more union variables but it is optional. The union tag is optional and each member definition is a normal variable definition, such as int i or float f or any other valid variable definition. The format of the union statement is as follows − The union statement defines a new data type with more than one member for your program. ![]() To define a union, you must use the union statement in the same way as you did while defining a structure. Unions provide an efficient way of using the same memory location for multiple-purpose. You can define a union with many members, but only one member can contain a value at any given time. A union is a special data type available in C that allows to store different data types in the same memory location.
0 Comments
Leave a Reply. |