I am trying to declare a structure outside main function. I was able to declare its variables outside the main function but when i try to initialize them the way shown below:
struct test
{
int a;
};
struct test abc;
abc.a=1;
int main()
{
printf("%d\n",abc.a);
return 0;
}
I am getting error error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
. When i initialize the structure variables at the time I declared them, everything goes smooth but i am getting an error when using the way above. Why is it happening and what does this error mean?