I have a struct with an array as a member, and am trying to set that array using arrow syntax. What I have:
typedef float Foo[3];
typedef struct {
Foo foo;
} Bar;
Bar* f() {
Bar* bar = malloc(sizeof(Bar));
bar->foo = {1.0, 1.0, 1.0};
return bar;
}
gcc says:
error: expected expression before '{' token
on the line bar->foo = {1.0, 1.0, 1.0};
I'm at a loss why this doesn't work. Thanks in advance.