};
Note the restriction in a nested structure shown by the next example:
struct Emp
{
char name[40];
int age;
float salary;
struct Emp e; /* is illegal */
};
Thus, a member of a structure can also be another structure. That is, you can say that the individual
structure members of a structure can be other structures as well.
Structures whose members are
themselves structures are called nested or hierarchical structures.
For example,
say we want to nest a structure named
address
inside another structure
Employee;
there are two ways of declaring such a nested structure:
I. First method:
Do'stlaringiz bilan baham: