我定义了以下结构:
typedef struct {
double salary;
} Employee;
我想改变salary
. 我尝试通过引用传递它,但值保持不变。下面是代码:
void raiseSalary (Employee* e, double newSalary) {
Employee myEmployee = *e;
myEmployee.salary = newSalary;
}
当我调用这个函数时,salary
保持不变。我究竟做错了什么?