Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Example of using array of structure

Posted By: Eleanor Hughes     Category: C Programming     Views: 31977

Example of using array of structure.

Code for Example of using array of structure in C Programming

Struct address        \\ A
     {
    plot char [30], struc char[30];
    city char[30]
     }
struct student        \\ B
     {
    name char[30];
    marks float;
    struct address adr;      \\ C
     }    
main ( )
     {
    struct student student1;    \\ D
struct student class[20];    \\ E
    class[1].marks = 70;    \\ F
    class[1].name = “ Anil “;
    class[1].adr.plot = “7 ”;      \\ G
    class[1].adr.street = “ Mg Road”;
    class[1].adr.city = “mumbai”;

printf( “ Marks are %d\n”, class[1].marks);
printf( “ name are %s\n”, class[1].name);
printf( “ adr.plot is %s\n”, class[1].adr.plot);
printf( “ adr.street is %s\n”, class[1].adr.stret);
printf( “ adr.city is %s\n”, class[1].adr.city);
     }
  
Share: 


Didn't find what you were looking for? Find more on Example of using array of structure Or get search suggestion and latest updates.

Eleanor Hughes
Eleanor Hughes author of Example of using array of structure is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!