typedef struct A A;
typedef struct B B;
struct A
{
int a1;
int a2;
};
struct B
{
A;
int b1;
int b2;
};
B bvar = {
.B = {
.a1 = 2,
.b1 = 2,
},
};
--- Begin Message ---
On Thu, Dec 4, 2008 at 1:07 PM, Gorka Guardiola <[EMAIL PROTECTED]> wrote:
> 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
> };
>
There is a way, with a display, but I wanted to name the fields.
This works:
B bvar = {
0,
0,
0,
0
};
I guess I can always add comments.
--
- curiosity sKilled the cat
--- End Message ---