Loading video...
Structures
- Structures are a mechanism to better organize data
- The “struct” syntax, struct { member, member, etc. };
- Some examples using structures are presented, such as a “person” with a name and an age
- Members of a structure variable are accessed using the dot (.) operator, e.g. var.member
- Structures can contain members that are themselves structures
- Structures can be initialized at compile time, or at run-time
- Structures can be organized in arrays
- Even multi-dimensional arrays
- Pointers can point to a structure,
- This allows for run-time allocation and de-allocation of structures
- This is also the only way a structure may have itself as a member
- Members of a structure pointer are accessed using the (–>) operator, e.g. ptr–>member
- Here is more information about C++ data structures: http://www.cplusplus.com/doc/tutorial/structures/
Structures
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.
- Intro
- Overview
- Keep Data Organized
- Structure Declaration
- Structure Declaration
- Structure Usage
- Accessing Members
- Structure Member Structures
- Initializing Member Structures
- Arrays of Structures
- Multi-Dimensional? Of Course!
- Pointers to Structures
- Pointed-to Structure Members
- Structure Pointer Operator
- Structure for Pointers

































Start Learning Now
Our free lessons will get you started (Flash® 10 required).
Sign up for Educator.comGet immediate access to our entire library.
Features Overview