In C/C++, Structures and Union are two user-defined data types. In this blog post, we will try to understand how they both work and how exactly are they different from each other.
Understanding a Structure (struct)
Struct is a user-defined data-type that’s used to store a combination of data which can potentially belong to different data-types. To explain further, think about how you can store information about a student in C/C++, where, you need to store the following parameters: