Subj : Re: strange string pointer to strings...? To : borland.public.cpp.borlandcpp From : maeder Date : Sat Oct 01 2005 10:54 am Bob Gonder writes: > Thomas Maeder [TeamB] wrote: > >>Bob Gonder writes: >> >>>>/* list of words and meanings */ >>>>char *dic[][40] = { >>>> "atlas", "A volume of maps.", >>> >>> This would more properly be written >>> >>> char *dic[] = { >>> "atlas", "A volume of maps.", >>> "car", "A motorized vehicle.", >>> "telephone", "A communication device.", >>> "airplane", "A flying machine.", >>> >>> 0,0 /* null terminate the list */ >>> }; >> >>Better yet >> >>char const *dic[][40] = { > > Now, see... that looks a lot like a two dimensional array of pointers > to me. I meant to only add const to your suggestion; but I didn't. The correct definition of dic is char const *dic[] = { "atlas", "A volume of maps.", "car", "A motorized vehicle.", "telephone", "A communication device.", "airplane", "A flying machine.", 0,0 /* null terminate the list */ }; It's simply a bad idea to let a pointer to non-const point at objects that must not be modified. .