175. C Program to Store the Given Records in Nested Structure.
How does this program work?
- This Program is used to store the given records in nested structure.
Here is the code
struct date
{
int day;
int month;
int year;
};
struct student
{
char name [50];
int roll;
struct date dob;
};
int main(void)
{
int i,j,n=1;
struct student a[50];
{
for(i=0;i< n;i++)
{
printf("Enter your name:\n ");
scanf("%s",&a[i].name);
printf("Enter your roll number:\n");
scanf("%d",&a[i].roll);
printf("Enter your Date of Birth (dd/mm/yy):\n");
scanf("%d%d%d",&a[i].dob.day,&a[i].dob.month,&a[i].dob.year);
}
printf("\n");
for(j=0;j< n;j++)
{
printf("Name :%s \n",a[j].name);
printf("Roll Number : %d\n",a[j].roll);
printf("Date of Birth(dd/mm/yy) : %d/%d/%d\n",a[j].dob.day,a[j].dob.month,a[j].dob.year );
printf("\n");
}
}
return 0;
}