Monday, July 15, 2019

Structure

Structure

stucture


Structure is a collection of variables under a single name.Structures are used to represent a record.C Structure is a collection of different data types which are grouped together and each element in a C structure is called member.

It is partially similar to an Array, but an array holds data of similar type only, but structure can store data of any type.

For example:
                     
If user want to keep record of  books in a library.user might want to track the following attributes about each book −
                       
              Title
               Author
               Subject
                Book-Id

Syntax Of Structue:
           
struct[structure tag]
            {
            //variable1;
                    //variable2;
                   //variabl3;

            }[structure_variable];


Example:

            struct student
            {
                char name[25];
                int age;
                char gender;

            }s1,s2;


EmoticonEmoticon