+2 votes
in Class 12 by kratos

What is nested structure? Give example.

1 Answer

+4 votes
by kratos
 
Best answer

A structure defined as a member of another structure is called 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 admissiondate;

}

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 a integer datatype, 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.

...