Here is a code snippet:
typedef struct foo {
int i;
int o;
} foo;
int main() {
foo bar2 = {
.i = 42;
.o= 24;
};
foo bar1;
bar1.i = 42;
bar1.o = 24;
}
I am trying to initialize the variable bar2 within the declaration, but it didn't work. But the initialization of the struct bar1 works pretty fine.
Can Anybody tell me why the initialization of foo2 gives a SyntaxError?