I am learning about nested structs in C, and what I want to do is to be able to assign a value to my struct's member struct. I'm having trouble figuring this out, and I don't want to force myself to initialize the member struct in the initialization of the struct. Why do I keep getting an error when I try to compile this code?
main.c: In function 'main': main.c:16:23: error: expected expression before '{' token fooPerson.fullname = {"Foo", 'B', "Baz"};
#define LEN 20 struct names { char first[LEN]; char middle; char last[LEN]; }; struct person { struct names fullname; }; int main() { struct person fooPerson; fooPerson.fullname = {"Foo", 'B', "Baz"}; // NOT this: it works, but not the solution I'm asking for // struct person fooPerson = {{"Foo", 'B', "Baz"}}; }