Programming in C++Dale/Weems/HeadingtonChapter 14Records ( C++ Structs )
PPT Slide
Limitation of array type
thisAnimal
anotherAnimal
struct AnimalType
struct type declaration
More about struct type declarations
Accessing struct members
Valid operations on a struct member depend only on its type
Aggregate struct operations
Examples of aggregate struct operations
Array of structures
AnimalType bronxZoo[MAX_SIZE] ;
Add 1 to the age member of each element of the bronxZoo array
Write id and genus for each element of bronxZoo array from country “China”
Find total weight of all elements of the bronxZoo array
Hierarchical structures
struct MachineRec
struct type variable machine
Unions in C++
Using Unions
Email: ssorkin@essex.cc.md.us
Home Page: http://www.essex.cc.md.us/Essex/People/ssorkin/index.html
Download presentation source