Structure
In C++
" It is a collection of variables referred under one name. "
Structure can be Defined as -
- struct is the keyword.
- structure is a collection of related data types known as a members of structure.
- It is very powerful.
- In array , we group of same data type but in structure we can able to group different data types.
- structure is always end up with a (;) semicolon .
Now we have to makes the object of the structure student [ name_of_the_structure obj; ]
Object -
- Is an run time entity.
- It contains all the members and its functions
- we can not use structure without making its object.
- object of student S1.
- S1 has its own name , roll number and percent.
- like that we can create as many as objects.
Note - The Members of the object can be assessed bu using ( . ) dot operator.
Ques - Write a program to make a structure to enter book name and its author name then display it.
Program -
Output -
Comments
Post a Comment