1.

Explain the nesting of structures with an example.

Answer»

A structure defined as a member of another structure is called a nested structure.

Example of a nested structure:

struct date

{

int day;

int month;

int year;

};

struct student

{

int regno;

char name[20];

char class[10];

struct date dob;

struct date admission date;

}st1, st2, st3;

In the above example, st1, st2, and st3 are the structure variable of type student and date is a structure definition. The members of student structure are regno, is an integer data type, name and class which are char type and dob admission date are date structure type variable members. The dob and admission date are and the structure variable who are members of another structure.



Discussion

No Comment Found