All Online Learning

C Programming

Concept of Structure in C

Structure is a collection of diffrent type of data element.

Syntax:

                         struct struct_name {
                         DataType member1_name;
                         DataType member2_name;
                         DataType member3_name;
                            …
                              }; 
                       
where struct--> Structure keyword, struct_name--> Name of Structure, member1_name,member2_name..--> Structure elements

Example:

                         struct Books {
                         char  title[50];
                         char  author[50];
                         char  subject[100];
                         int   book_id;
                           };
                       

www.allonlinelearning.com