Say I have a couple of structs like: typedef struct A A; typedef struct B B;
struct A { int a1; int a2; }; struct B { A; int b1; int b2; }; Now I want to declare a variable of kind B with parts initialized. Is there anyway to initialize the A inside the B?. I have tried: B bvar = { .a1 2 .b1 2 }; B bvar = { .a1=2 .b1=2 }; B bvar = { .A { .a1=2} .b1 2 }; B bvar = { .A={ .a1 2} .b1 2 }; B bvar = { .A={2} .b1 2 }; I always get the error that the field does not exist. I have looked at the code of the compiler and run it with -di and have not been able to figure out a way to initialize the anonymous struct. Am I missing something?. Is there a way to do this?. -- - curiosity sKilled the cat