aa.a ?
Take a look at the example below, initializing the structure with {3}, similar to initializing with {3.0}.
Therefore, in your program, when you initialize with {0}, you actually initialize both a and b (the whole structure), with {0,0}
#include<stdio.h>
typedef struct A
{
int a;
int b;
}a;
int main()
{
a aa = {3};
printf("\na1 = %d",aa.a);
printf("\nb1 = %d",aa.b);
a bb = {3,0};
printf("\na2 = %d",bb.a);
printf("\nb2 = %d",bb.b);
}
source
share