I have a fairly basic question regarding Structs, Arrays, and I guess Field Referencing.
I have an array of structs. Each of those structs have 6 variables in them. I am trying to figure out how to store a struct in a temporary variable that I can change the values of without accessing the array each time.
For example, my struct has a double value named hours_in_week.
I have come to understand the following statement gives me a temporary copy of the struct, where I can access the variable values but not change them:
I have also come to understand that this statement:Code:employee tempEmployee = employeeArray[s];
allows me to edit the value of the struct in the array, but this statement:Code:employeeArray[s].hours_in_week += totalHours;
doesn't allow me to change the value of the struct it represents.Code:tempEmployee.hours_in_week += totalHours;
I would assume this is a matter of setting up pointers or something. A little guidance for future reference would be appreciated.
**I apologize if my C lingo isn't the best, I am naturally a JAVA programmer**