C Programming
Computer Programming

C program to demonstrate example of Nested Structure



Write a program in C to demonstrate example of Nested Structure

\* C program to demonstrate example of Nested Structure *\

# include < stdio.h >
# include < conio.h >
struct   dateOfBirth
{

int dd ;
int mm ;
int yy ;

} ;

int   main( )
{

struct student std ;
printf("\n Enter the personal Details : ") ;
printf("\n Enter name: ") ;
gets(std.name) ;
printf(" Enter roll number: ") ;
scanf("%d",&std.rollNo) ;
printf(" Enter Date of Birth [DD MM YY] format: ") ;
scanf("%d%d%d",&std.DOB.dd,&std.DOB.mm,&std.DOB.yy) ;
printf("\n Entered Details are : ") ;
printf("\n Name : %s \n RollNo : %d \n Date of birth : %02d/%02d/%02d\n", std.name, std.rollNo, std.DOB.dd, std.DOB.mm,std.DOB.yy ) ;
return 0 ;

}

Output of Program :

Output of C program to demonstrate example of Nested Structure