Back To C++ Structures
nested structure means structure within a structure
//program to create a structure student with members (rollno,name,marks and clas) input values from user and pass the structure variable to function which prints the values of the members of the structure variable #include
#include
struct student { int rollno; char name[20]; int marks; int clas; }; void display(student s) { cout<<"\nrollno of student is "<
>st.rollno; cout<<"\nenter name of student "; cin>>st.name; cout<<"\nenter marks of student "; cin>>st.marks; cout<<"\nenter class of student "; cin>>st.clas; cout<<"\nDisplaying the contents of structure variable student "; display(st); getch(); }