//Program for array of a stucture
#include<stdio.h>
#include<conio.h>
void main()
{
struct employee
{
int id;
char n[20];
char des[30];
char dept[30];
float sal;
};
struct employee e[50];
int i,no;
clrscr();
printf("enter the no.of employees:n");
scanf("%d",&no);
printf("enter the details for %d personsn",no);
printf("emp_id,emp_name,emp_des,emp_dept &emp_salaryn");
for(i=0;i<no;i++)
{
scanf("%d%s%s",&e[i].id,&e[i].n,&e[i].des);
scanf("%s%f",&e[i].dept,&e[i].sal);
}
printf(""n************O/P**********n");
printf("nemp_idtemp_nametemp_destemp_dept temp_salaryn");
for(i=0;i<no;i++)
{
printf("%d%s%s",e[i].id,e[i].n,e[i].des);
printf("%s%f",e[i].dept,e[i].sal);
printf("n");
}

getch();
}
***************O/P***************************
emp_id emp_name         emp_des           emp_dept       emp_salary

1      hemant          s/w_developer      s/w._company   20000
2      sara            Lecturer           CSE            22000
3      charan          Lecturer            IT            25000
//Program for nested structure
#include<stdio.h>
#include<conio.h>
void main()
{
struct address
{
char land[30];
int strtno;
int hno;
char city[20];
};
struct date
{
int d;
int m;
int y;
};
struct person
{
int id;
char n[20];
int age;
struct date D;
struct address A;
};
struct person p;
int x;
clrscr();

printf("enter the details of the person:n");
printf("Id,name, agen");
scanf("%d%s%d",&p.id,&p.n,&p.age);
x=strupr(p.n);
//printf("%s",x);
printf("enter DOBn");
scanf("%d%d%d",&p.D.d,&p.D.m,&p.D.y);
printf("enter address land,strtno,hno,cityn");
scanf("%s%d%d%s",&p.A.land,&p.A.strtno,&p.A.hno,&p.A.city);
printf("n**********OUTPUT***********n");
printf("ID=%dnNAME=%snAGE=%dnDOB=%d/%d/%dnADDRESS=%st%dt%dt%s"
,p.id,x,p.age,p.D.d,p.D.m,p.D.y,p.A.land,p.A.strtno,p.A.hno,p.A.city);
getch();
}
Enter the details of the person:
Id,name,age
12
sara
24
enter DOB
05
04
1987
enter address land,strtno,hno,city
Mahakali_colliery
20
N/17
Chandrapur
******************OUTPUT********************
ID=12
NAME=SARA
AGE=24
DOB=05/04/1987
ADDRESS=Mahakali_colliery 20 N/17 Chandrapur

Structure