Structures and Arrays
It is also possible to define structures that contain arrays as members. One of the most common
applications of this type is in setting up an array of characters inside a structure.
For example,
say we want to define a structure called
month
that contained as its members the
number of days in the month as well as a 3-character abbreviation for the name of the month. This is
done as follows:
struct month
{
int number_of_days;
char name[3];
};
Do'stlaringiz bilan baham: