M
Mike Copeland
How can I reinitialize all the values in the structure object below?
This structure object (myTest) is common to several subprograms in a
larger program, and when I engage any of the subprograms I want to
assure that the structure is (re)initialized to the zero value I've
defined in its declaration.
I know that the size of the object is 16 bytes (on my machine), but I
sorta doubt that a memmove of 16 bytes of 0 is an appropriate way to do
this (UB?), and since the elements are not an array I can't initialize
it iteratively (or can I?).
I also tried to make an assignment like the declaration [ myTest = {
0 }; ], but I got a compiler error. So that isn't the answer... 8<{{
Please advise. TIA
struct TestStructure
{
int aa, bb, cc, dd;
} myTest = { 0 };
This structure object (myTest) is common to several subprograms in a
larger program, and when I engage any of the subprograms I want to
assure that the structure is (re)initialized to the zero value I've
defined in its declaration.
I know that the size of the object is 16 bytes (on my machine), but I
sorta doubt that a memmove of 16 bytes of 0 is an appropriate way to do
this (UB?), and since the elements are not an array I can't initialize
it iteratively (or can I?).
I also tried to make an assignment like the declaration [ myTest = {
0 }; ], but I got a compiler error. So that isn't the answer... 8<{{
Please advise. TIA
struct TestStructure
{
int aa, bb, cc, dd;
} myTest = { 0 };