will it initialize all the variable in structure to spaces?Code:struct X { char a[10]; char b[10]; }; struct X x; memset(&x,0x20,sizeof(x));
will it initialize all the variable in structure to spaces?Code:struct X { char a[10]; char b[10]; }; struct X x; memset(&x,0x20,sizeof(x));
will it initialize all the variable in structure to spaces?Code:struct X { char a[10]; char b[10]; }; struct X x; memset(&x,0x20,sizeof(struct X));
Yes, but it will not add any '\0' so a & b are still invalid strings.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Not with a single memset, no. Not any easier than just either doing it in the first place by hand, or by calling strncpy or something.Code:struct foo bar = { "...9 spaces...", "...9 spaces..." };
Quzah.
Hope is the first step on the road to disappointment.