Nested Structure in C

In C language, we can create nested Structure (Structure within Structure). There are two ways to define a nested structure.

  1. By separate structure
  2. By Embedded structure

 

  1. Separate structure

In a separate structure, we can create one or more structure inside the main structure as a member.

Syntax:

 

  1. Embedded structure:

The embedded structure can be created within the structure. Let us consider how to declare the embedded structure.

Syntax:

Example

Write a program of Nested structure in C language.

Output

Leave a Comment