Skip to main content

Posts

Showing posts with the label examples of structure

Processing a Structure in C programming

                  The members of a structure are usually processed individually, as separate entity. A structure member can be accessed by writing    structure_variable.member              Here, structure_variable refers to the name of  a structure-type variable and member refers to the name of a member within the structure. Again, dot that separates the variable name from the member name.                  In the case of nested structure (if a structure member is itself a structure), the member within inner structure is accessed as                structure_variable.member.submember                ...

Structure in C programming

A structure is a collection of variables usually of different types that can be used as a single item to handle data more efficiently. An array can be used only to represent a group of data items that belong to the same type. But, if we want to represent a collection of data items of different types using a single name, array can not be used. At that situation, structure is used.             Defining a Structure: Syntax:      struct   structure_name                 {                   type1 member_variable1;                  type2 member_variable2;                  . ...