我希望你能帮我翻译一下关于IT技术的内容。需要翻译的是有关C语言中分配结构体函数的问题。理想情况下,我希望这个函数可以使用传入的参数填充结构体的字段。
我已经在头文件中定义了这个结构体:
typedef struct {
char name[NAME_SIZE]; //Employee name
int birthyear; //Employee birthyear
int startyear; //Employee start year
} Employee;
这是我目前的函数内容:
void make_employee(char _name, int birth_year, int start_year) {
Employee _name = {_name,birth_year,start_year}; //allocates struct with name
} /* end make_employee function */
有没有关于如何完成这个任务的建议?