There are two ways to declare a structure variable:
Syntax
struct structName {
type1 memberName1; // Members are declared just
... // like odinary variables
typen memberNamen;
} variableName1, ..., variableNamen;
Code example
// structure to handle color values
struct rgb {
int red;
int green;
int blue;
} color; // declare color of type rgb
Syntax
struct structName variableName1, ..., variableNamen;
Code example
// structure to handle color values
struct rgb {
int red;
int green;
int blue;
}
...
struct rgb color; // declare color of type rgb