A structure is a user-defined compound data type which consists of data members related to a person or an item. It is referred to record in other programming languages.
Note : The structure definition ends with a semicolon ( ; ) after the closing brace.
Structure variables can be declared using the tag-name of the structure along with the keyword struct.
It declares structure variables x, y and z and an array std with 50 elements.
Dot (.) or period operator is used to access a data member in a structure variable or an array element. It has the following form :
Note : That the dot operator separates the structure variables or array and the data member.
sizeof() of a structure is equal to the total number of bytes occupied in RAM by various data members in the structure.
The size of this structure is equal to 24bytes ( 2bytes for int + 20bytes for char + 2bytes for int ). The sizeof() function is written as follows to print the size of the structure :
Currently we improved our website User Interface and other contents. Our next update is adding video tutorials on this site so, We create a new YouTube channel, our YouTube channel name is CodeX.
We need some time for make video tutorials (CodeX) so, stay with us and keep supporting and you know already we make a Collaboration with HackIsOn YouTube channel long time ago So, please Subscribe Our Channels