Structures in c
A structure is a collection of variables under a single name. These variables can be of different types, and each has a name which is used to select it from the structure. A structure is a convenient way of grouping several pieces of related information together.
Further Uses of Structures
A structure is a good way of storing related data together.It is also a good way of representing certain types of information. Complex numbers in mathematics inhabit a two dimensional plane (stretching in real and imaginary directions). These could easily be represented here by
struct complex
{
double real;
double imag;
}
doubles have been used for each field because their range is greater than floats and because the majority of mathematical library functions deal with doubles by default.
Structures can also be used as
1. Members of other structures.
2. Arrays of structures are possible, and are a good way of storing lists of data with regular fields,
such as databases.
3. Use to creat link list, trees and other connected structures.