Nesting Structures in C
Structure elements can be nested
Example
#include <stdio.h> int main() { struct address { char phone[15]; char city[25]; int pin; }; struct emp { char name[25]; // declaring structure element inside another structure struct address a; }; // struct emp will consist of 4 elements now : (name,phone,city,pin) struct emp e = { "John", "563269", "New York", 2365 }; printf("\nname = %s phone = %s", e.name, e.a.phone); printf("\ncity = %s pin = %d", e.a.city, e.a.pin); getchar(); return 0; }