Tried C++ standard, but couldn't figure it out. Are these equivalent?
double x[2] = {0.0, 0.0};
and
double x[2] = {};
How about these?
struct A {
double x[2];
};
A a = {0.0, 0.0};
and
A a = {};
Thank you!
The C++ standard says (8.5.1):
If there are fewer initializers in the list than there are members in the aggregate, then each member not explicitly initialized shall be value-initialized
and value-initialization of a double is to set it to 0.0.
So yes! In C++ they are equivalent.
[I haven't had time to check the C99 standard.]
A a = { {0.0, 0.0} };