Subj : Re: how to initialize this? To : borland.public.cpp.borlandcpp From : maeder@glue.ch (Thomas Maeder [TeamB]) Date : Thu Oct 16 2003 08:23 am Eric writes: > I was afraid of that (that i might not be very clear). What i am basically > trying to do is to have an array of Farm structures each containing the > same Animals. I want to intialize the animal names at compile time. Is your problem that arrays are not "first class" entities in C and C++ and thus can't be copy-constructed nor copy-assigned? If yes, you could wrap the array type into a struct type: struct TAnimal { char const *Name; int Value; }; struct TFarm { TAnimal population[3]; }; TFarm const farmTemplate = { { {"dog", 0}, {"horse", 4}, {"cow", 6} } }; TFarm Farm0(farmTemplate); TFarm Farm1(farmTemplate); TFarm Farm2(farmTemplate); Adding another animal would involve changing the array size and farmTemplate's initializer. If you forget the former, the compiler will tell you. .