Utilizor
Contact Us

C++ Structures

Grouping related variables.

C++ Structures (struct)

Structures (also called structs) are a way to group several related variables into one place. Each variable in the structure is known as a member of the structure.

Unlike an array, a structure can contain many different data types (int, string, bool, etc.).

Create a Structure

To create a structure, use the struct keyword and declare each of its members inside curly braces.

After the structure context is defined, you can create variables of this type by using the structure name.