Subj : Re: how to initialize this? To : borland.public.cpp.borlandcpp From : maeder@glue.ch (Thomas Maeder [TeamB]) Date : Thu Oct 16 2003 12:17 am Eric writes: Your description is far too complicated for me to understand it. So just a side note, which is unrelated to your question: > typedef struct { > char *Name; > int Value; > }TAnimal; > > TAnimal Farm0[] = {{"dog", 0}, {"horse", 4}, {"cow", 6}}; This initializes the Name members of the Farm0 elements with the addresses string literals. An implicit conversion from 'array of N char const' to 'pointer to char' (non-const) is performed each time. Such a conversion is conforming to the ISO C++ Standard, but that standard also says that it is deprecated. The reason is that it's very easy for the inadvertent programmer to accidentally modify a string literal through such a pointer to non-const. Such a modification would cause your program to have undefined behavior. So better define your struct like this: typedef struct { char const *Name; int Value; } TAnimal; If this type is only used from C++ code (and not from C code), the usual way to define it would be struct TAnimal { char const *Name; int Value; }; .