Nested structures

A structure defined inside another structure is called a nested structure. It allows us to organize related data and set a hierarchy in the code format, reducing the complexity of the code and making it easier to understand.

Defining structures inside other structures

To define a nested structure, we can declare the whole structure (Example 1) or a structure variable (Example 2) inside another structure.

Get hands-on with 1200+ tech skills courses.