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 :
We Are Currently Working On Our Android Application Development and We already have two YouTube channels their name is CodeX or NightHawk. CodeX is for programming related videos and NightHawk is for online game streaming so please supporting us and Subscribe to our channels, Thank you