What is nested structure?
A structure can be placed with in another structure i.e a structure can contain another structure as its member Like we declare an int member or char member. A structure that contains another structure as its member are called nested structure.
Example
Example
struct dob {
int date;
int month;
int year;
};
struct student {
char name[20];
int roll;
char gender;
int marks[5];
struct Dob birthday;
};
Explanation: The structure variable birthday of type struct dob is nested inside struct student. It should be clear that you cannot nest a structure variable of type struct student inside struct student.
Structure variables of different types can be nested as well. Let’s see an example
Tab #1
Tab #1