Why structs cannot be assigned directly?
问题 Suppose I have a fully defined struct with tag MyStruct , and suppose that x, y, ..., z are allowed values for its fields. Why is struct MyStruct q = {x,y,..,z}; allowed, but struct MyStruct q; q = {x,y,...,z}; is not allowed? I find this very annoying. In the second case, where I have previously declared q , I need to assign a value to each field, one by one: q.X = x; q.Y = y; ... q.Z = z; where X, Y, ..., Z are the fields of MyStruct . Is there a reason behind this? 回答1: What you are