Subj : Re: structure initialization? To : borland.public.cpp.borlandcpp From : maeder Date : Wed Sep 22 2004 07:27 pm " Bruce Salzman" writes: > struct MyStruct{ > int a; > bool b; > float c; > }; > > MyStruct A; > A.a, A.b, A.c will contain garbage unless you're explicit: > > MyStruct A={ 1, false, 3.141}; > > You can also get away with > memset(&A, 0, sizeof(A)); This latest suggestion is not guaranteed to work portably. .