struct name {
type name;
type name;
};
struct imag {
float real_part;
float imag_part;
};
struct name {
type name;
} name1,name2;
imag x,y;
declares two variables of type imag.
x.real_part = 5.3; y.imag_part = 2.7;sets the real and imaginary parts of the structure x.
struct address_rec {
int house_number;
string stree_address;
string city;
string state;
}
struct telephone_rec {
int area_code;
int exchange;
int local_number;
}
struct student_rec {
string name;
address_rec address;
telephone_rec phone;
}
student_rec student;
student.name = "Dan";
student.address.city = "edinboro";
student.phone.area_code = 814;