Structure In Structure
A structure is a convenient method of handling a group of related data items of different data types.We can use another structure variable in a strucutre.
/*
http://www.ProbCOMP.com
Structure is a method of packing data of different types.
A structure is a convenient method of handling a group of related data items of different data types.
We can use another structure variable in a strucutre.
*/
#include<stdio.h>
struct date
{
int day;
int month;
int year;
};
struct student
{
char name[20];
int age;
struct date dob;
float percentage;
};
void main()
{
struct student s;
printf("enter name :");
gets(s.name);
printf("enter age :");
scanf("%d",&s.age);
printf("enter percentage :");
scanf("%f",&s.percentage);
printf("enter date of birth as e.g. 19 01 1985 : ");
scanf("%d%d%d",&s.dob.day,&s.dob.month,&s.dob.year);
}
Download Program


