Structure are used to store different data types values into a single variable. Know a days every it project executes through the structure concept.
(or)
It is an user defined data type which is used to store different (or) similar data types values.
Definition:-
Collection of values with similar (or) different data types is known as a structure.
struct tagname
{
member 1;
member 2;
:
:
member n;
};
In the above syntax , struct is a key word which defines the structure. tagname is an identifiar. Data members are nothing but variables.
struct student
{
int no;
char name[20];
};
In the above example stud is a user defined structure (or) data type. This user defined data type contains two members.
1. No.of int type
2. No.of char type
It means the user defined data type stud stores are defines two types of values
Structure variable :-
The name given to the memory for storing the members of the structure is known as structure variable.
Syntax:-
[struct] structurename structurevariablename;
(or)
[struct] structurename structure variable1, structure variable2,............structure variable n;
Ex :-
Student s;
Student s1,s2;
Accessing data members of the structure:-
We can access the data members of the structure by using period operator ( . ).
Ex:-
s.no=25;
s.name="prasad";
s.no=s1.no+s2.no.
---------------------------------------------------------------------------------------------------------------
>> Back to Notes of C-Language (Topic Wise)
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
>> Back to Quiz of All Computer Courses
>> Back to Shortcuts of All Computer Courses
>> Back to Video Tutorials of All Computer Courses
>> Back to Abbreviations
>> Back to Shortcuts of All Computer Courses
>> Back to Video Tutorials of All Computer Courses
>> Back to Abbreviations
---------------------------------------------------------------------------------------------------------------
Post a Comment