...

/

Introduction to a Union

Introduction to a Union

Get introduced to a union and its basic syntax with the help of an interactive example.

All secondary types are built out of primary data types. Of these, this chapter discusses the data type called Union.

What is a union?

The purpose of both a union and a structure is to group dissimilar items together. But the key difference is that a structure allocates enough memory to store all of its members in memory. Whereas, a union allocates memory equal to the ...