我应该通过参数还是通过返回值初始化C结构?[关闭]
我工作的公司正在通过初始化函数来初始化所有数据结构,如下所示: //the structure typedef struct{ int a,b,c; } Foo; //the initialize function InitializeFoo(Foo* const foo){ foo->a = x; //derived here based on other data foo->b = y; //derived here based on other data foo->c = z; //derived here based on other data } //initializing the structure Foo foo; InitializeFoo(&foo); 我遇到了一些尝试初始化我的结构的问题: …