I know you can initialize an array to all zeroes like so:
int a[10] = { 0 };
And, as another example, this would initialize the first element to 1 and the rest to zero:
int a[10] = { 1 };
But can you do the same thing with a struct?
1 2 3 4 5 6
struct Thing {
int a, b, c;
};
Thing thing1 = { 0 }; // all members 0
Thing thing2 = { 1 }; // Member a = 1, b = c = 0
I've tested it and it seems to work, but is it guaranteed to work by the standard? (I'm trying to read that thing, but OUCH, what a document! It hurts my head.)