Write about Structures within Structures?

https://www.computersprofessor.com/2016/12/write-about-structures-within-structures.html
|
Structures within a structure mean
nesting of structures. Nesting of structures is permitted in C.
For example: The following Structure
defined to store information about the salary of employees.
struct salary
{
char name;
char dept;
int basic;
int dearness_allowance;
int house_rent_allowance;
int city_allowance;
} emp;
This structure defines name,
department, basic pay & 3 kinds of allowances. We can group all the items
related to allowance together and declare them under a structure as shown
below.
struct salary
{
char name;
char dept;
struct;
{
int da;
int hra;
int city;
}
allowance;
}
emp;
The salary structure contains a
member named allowance. Which itself is a structure with 3 members. The
members contained in the inner structure namely da, hra and city can be referred
to as :
emp.allowance.da;
emp.allowance.hra;
emp.allowance.city;
|