|
|
*
|
|
C structures are similar to records in Pascal, they
allow us to collect together several pieces of related
data into one block. The individual pieces of data are
called structure elements or structure members
The declaration of a structure does not allocate
memory, it just provides a template for the structure.
It specifies the quantities that are being grouped
together
For example, we could have the following for the
declaration of a name structure
struct Person {
char* first;
char* last;
};
This structure has two elements, the pointersfirstand
last, which are used to access an array of characters.
Other variables can have the same name as structure
elements, and the same element name can be used in
different structure declarations. You will not find this
to be a problem, because the compiler recognizes all
potential ambiguities.
There are several ways to create a variable that has a
structure type
structStructureNameVariableName;
|
|