
240 Fundamentals of Computer Programming and IT
8.18.1 Structure and Classes
Keyword struct
The struct is a keyword and used to combine variables of different data types into a single record.
Syntax:
struct < struct name >
{
<data-type> <variable-name1, variable-name2;
<data-type> <variable-name3, variable-name4;
} <structure variable declarations>;
struct name : An optional tag name that defines the structure type.
structure variables : These are member variables and hold data.
Though struct name and structure variables are noncompulsory, one of them should
be present. Member variables in the structure are declared by naming a <data-type>, followed ...