Monday, 23 February 2015

Nested Structure in C


/* Nested Structure   */

#include<stdio.h>
#include<conio.h>

struct Student
{
int eno;
char name[50];
int age;
struct Address
{
char add[50];
}ad;
}s;

main()
{
int i=0;

clrscr();

printf("\n Enter Entrollment No :");
scanf("%d",&s.eno);
printf("\n Enter Your Name :");
scanf("%s",&s.name);
printf("\n Enter Your Age :");
scanf("%d",&s.age);
printf("\n Enter Your Address :");
scanf("%s",&s.ad.add);

printf("\n Entrollment No :%d",s.eno);
printf("\n Your Name :%s",s.name);
printf("\n Your Age :%d",s.age);
printf("\n Your Address :%s",s.ad.add);
getch();
}

No comments:

Post a Comment