Bifalgorithm post · Computer science one · Declaration & Initialization
How can one structure be composed of another structure?
How can one structure be composed of another structure? (Computer science one · Declaration & Initialization) — "typedef struct {\n\nint id;\n\nchar *firstName…
Ideas in this flowchart
- Structures can be composed by including one structure in another.
- The Student structure is declared with id, firstName, lastName, gpa, and Date dateOfBirth.
- The dateOfBirth member has the Date structure type.
- The Date structure is declared with year, month, and date.
- A defined structure can be used like a normal variable.
- Including Date in Student illustrates structure composition.
- The Student structure owns an instance of the Date structure.
- The Date structure must be declared before the Student structure.
- This requirement is like declaring variables before using them.