Next: Pointers
Up: Data Structures
back: Strings
-
Structures group related items whose type may differ
-
Information stored within a structure are called members
-
A structure defines a template for future variable definitions
-
After you define a structure, you can use the
structure name (tag) to declare variables of the structure type
-
To assign a value to or access the value of a structure member,
your programs use the C++ dot operator, such as variable.member
-
If a function changes the value of a structure member, the structure
variable must be passed to the function by address
-
When a function uses a pointer to a structure, the function should
use the format variable->member to access a structure member