// demonstrates using arrays with structures // Mikhail Nesterenko // 10/9/2013 #include #include using std::string; // example structure struct example{ int a; string b; }; struct exampleWArray{ // structure with member array int a; int b[5]; }; int main(){ example as[4]; // declaring array of structures as[3].a=123; as[3].b="Hello"; // accessing members exampleWArray se; // declaring structure variable // where element is an array se.a = 123; // accessing scalar member se.b[3]=456; // accessing element of the array member }