Structure is a data type that could store various data type.
The difference between structure and array is array can only store the same data type as the array data type while structure could store various data type.
Syntax
struct struct_name
{
data_type1 var_name1;
data_type2 var_name2;
...
};
Two ways to declare the struct variable :
1.
struct struct_name
{
data_type1 var_name1;
data_type2 var_name2;
...
} struct_variable;
2.
struct struct_name
{
data_type1 var_name1;
data_type2 var_name2;
...
};
struct struct_name struct_variable;
{
data_type1 var_name1;
data_type2 var_name2;
...
};
struct struct_name struct_variable;