STRUCTURE IN C LANGUAGE

 
A structure is the collection of different data Items and having on common name.  The general syntax for defining a structure is as follows:-
     Struct
{
    ;
}    < structure variable>;
We can directly access all the data members of the structure with the help of
< Structure variable>and (.)Dot operator.
For example: –      struct student
                      {
                             int   suo, age;
                            char name [25];
                       } s;
If we want to access sno that we can directly access with the help of s.sno}


             

Structure in C programming



ARRAY OF STRUCTURE: if we want to store more than one student’s data
Then we have to use the concept of array of structure.
        The general syntax for defining the array structure is as follows:-
        Struct  student
   {
          int     sno, age;
          Char name [25];  
    } s [10];
NESTED STRUCTURE:if we define structure within a structure then this concept is known as nested structure.
        The general syntax for defining a nested structure is as follows:-
 Struct   
{
              ;
   Struct
{
              ;
}   ;
}   ;

Leave a Reply

Your email address will not be published. Required fields are marked *

x