Union is a collection of heterogeneous data type but it uses efficient memory utilization technique by allocating enough memory to hold the largest member. Here a single area of memory contains values of different types at different time. A union can never be initialized.
for more info visit this pageA union is a special data type available in C that allows to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Unions provide an efficient way of using the same memory location for multiple-purpose. For detail information must visit Best & Affordable Computer Science Homework Help
It can be treated as a user-defined data type just like structure. The difference between the structure and union is that where each member present in structure takes its own memory..while in case of union, only the largest sized member memory is reserved by the union.
Union is user defined data types it is similar to structure but differs in
allocated size for it =size of largest member size (save memory) which means that you access one member at a time
allocated size for it =size of largest member size (save memory) which means that you access one member at a time
Union is a user defined data type.
Union test
{
int add;
char name;
float gom;
};
Shailesh Par ashar
Union test
{
int add;
char name;
float gom;
};
Shailesh Par ashar