A struct is a collection of data variables or values that are grouped together under a single memory block, whereas a data structure is typically some sort of collection of objects that are related to one another in some way. Therefore, a struct, also known as a structure, is less of a data structure and more of a complex data type. This definition sounds pretty simple, but appearances are deceiving in this case. The topic of structs is a complex one, and each of the languages we are examining has unique qualities in how structs are supported, if they are supported at all.
In this chapter, we will cover the following:
Definition of the struct data structure
Creating structs
Common applications of structs
Examples of structs in each language
Enums