- An array is a structured data type; all elements are of the same type (homogeneous data)
- A structure is also a structured data type; all elements do not have to be of the same type (heterogeneous data); other languages may refer to them as records
- A structure is a user-defined data type; once you have declared the structure, you may use it to define other variables
- Structures are used to group related data together; helps programmers organize their data in a logical manner
- A structure consists of basically two elements; the name of the structure and a list of variable declarations
- The variable declarations are used to declare members of the structure
The syntax for declaring structures:
struct Typename // name of the structure
{
type member_name; // variable declaration
type member_name; // variable declaration
. . . // other variable declarations
}; // don't forget semi-colon!
Notice that struct is a new keyword.