Monday, June 18, 2012

To demonstrate nesting of structures


/* Program to demonstrate nesting of structures */

#include<stdio.h>

#include<conio.h>

void main()

{

  struct employee

  {

     char name[10];

     struct address

     {

       char phone[10];

       char city[10];

       int pin;

     }a;

  };

  struct employee e={"Arnav","6234560016","Dallas",4210};

  clrscr();

  printf("\nName-->%s\nPhone-->%s",e.name,e.a.phone);

  printf("\nCity-->%s\nPincode-->%d",e.a.city,e.a.pin);

  getch();

}

 

OUTPUT

 

Name-->Arnav

Phone-->6234560016

City-->Dallas

Pincode-->4210

 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.