Structures within a Structure (Nested Structures)


A structure can be nested within another structure. Nested structures are used to create complex data types. Consider the example of structure type phonebook_entry created in Table 9.2(c). A record in a phone book consists of the fields: name of a person and his mobile number. The field 'name of a person' is a composite field that further consists of a person's first name and his last name. To construct such a type, which consists of composite fields, nested structures are used. The program segment in Program 18 illustrates the use of nested structures.

Program 18. A program that illustrates the use of nested structures

Post a Comment

Previous Post Next Post