Learn C++ in step-by-step lessons.
Structures: combining data elements
A data structure is defined using the struct keyword. It lets you combine data items of different types. The data items that make up a struct are called elements.
A struct is a user defined data type. A struct usually begins with an Uppercase letter.
Once the struct is defined, you can declare data items to be that type.
Goals:
- Be able to create and use a structure
Objectives:
- Define a structure
- Declare a structure
- Use a structure in a program
Please study the material at each of the links below.
- A student is a person
- Declaring with initial values
- A manager is an employee is a person
- A manager is an employee with initial values
- The time_t struct
- The current date and time
- Finding a Persons age
Glossary for structures lesson
Full Glossary