Nested structure in c

#include <stdio.h>

int main(){
    struct address{
    int hno;
    char hname [24];
    int pincode;
    };

struct student {
char name[70];
int age ;
int rollno;
struct address addr ;
};

struct student sumit = { "sumitbohare" , 18, 34, {612, "myhoouse", 455332}};


 printf("%s, %d, %d %d %s %d", sumit.name , sumit.age , sumit.rollno, sumit.addr.hno,sumit.addr.hname, sumit.addr.pincode );
 return 0;
}

Comments

Popular posts from this blog

Factors : using C

Cross shaped pattern

Factorial ! calculation