- Why do we need structs?
A struct (short for structure) allows us to group variables of mixed data types together into a single unit.
- What are members in a struct?
The variables that are part of the struct are called members (or fields).
- How do you access a member inside a struct?
In order to access the individual members, we use the member selection operator (which is a period)
Employee joe; // create an Employee struct for Joe
joe.id = 14; // assign a value to member id within struct joe
joe.age = 32; // assign a value to member age within struct joe
joe.wage = 24.15; // assign a value to member wage within struct joe
- What is a nested struct?
A struct containing other structs