Nested structure 2 in C.

01  #include<stdio.h>
02  
03  struct College
04  {
05   struct University
06   {
07    int uniCode;
08    char uniName[30];
09   }u;
10  
11   int clgCode;
12   char clgName[30];
13  
14  }c;
15  
16  int main()
17  {
18   printf("Enter Details : \n");
19  
20   printf("College Code : ");
21   scanf("%d",&c.clgCode);
22   fflush(stdin);
23  
24   printf("College Name : ");
25   gets(c.clgName);
26  
27   printf("University Code : ");
28   scanf("%d",&c.u.uniCode);
29   fflush(stdin);
30  
31   printf("University Name : ");
32   gets(c.u.uniName);
33  
34   printf("----------------------\n");
35   printf("Details : \n");
36   printf("----------------------\n");
37  
38   printf("College Code : %d \n",c.clgCode);
39   printf("College Name : %s \n",c.clgName);
40   printf("University Code : %d \n",c.u.uniCode);
41   printf("University Name : %s",c.u.uniName);
42  
43   return 0;
44  }

 OUTPUT :
 
 Enter Details :
 College Code : 1216
 College Name : SRSS
 University Code : 3422
 University Name : TYYU
 
 ----------------------
 Details :
 ----------------------
 
 College Code : 1216
 College Name : SRSS
 University Code : 3422
 University Name : TYYU