Code:
#include <stdio.h>
typedef struct
{
int a[2];
}twoint;
typedef struct
{
twoint a;
twoint b;
}foo;
Code:
/*main code with compile error: missing braces around initializer*/
int main()
{
foo a =
{
{1,2},
{3,4}
};
}
Code:
/*FIX: no compile error*/
int main()
{
foo a =
{
{{1,2}},
{{3,4}}
};
}
Does this fix looks correct?
Why is it necessary to put {} around the twoint struct?