1. Great, thank you.
2. Yes I used a for loop, did not check for null bit because I wasn't sure if the instructor would change the length of the passed array. I'm sure he will, and I will do this.
-You are correct about changing the char array sizes to [32] also, I was counting minus the null bit for some reason. Thank you.
-I will definitely look at
const. I can't change these function parameters, but it will be great to understand why in the future I need to do this.
3. The way I have it works somehow. The comment is almost directly from the SOW file he gave me. I originally had *sal = m_dSalary and received errors, so I changed it to what I thought might work, not really knowing why. My attempt to explain to myself what was happening seemed off, thus the question.
Edit: Just changed that line of code in 3. to *sal = m_dSalary again. It works now. I still don't really understand this part.
3a. Why does my original code work if you say it does nothing? I'm not trying to argue, I just don't completely understand. I.E.
employeeOne.getSalary(&salary);
Paired with
1 2 3 4
|
void EmployeeRecord::getSalary(double *sal)
{
sal = &m_dSalary;
}
|
3b. Also, this code
employeeOne.getSalary(&salary);
Paired with
1 2 3 4
|
void EmployeeRecord::getSalary(double *sal)
{
*sal = m_dSalary;
}
|
Previously did not work, I'm sure I had something missing...but I still don't understand the correct way to think of this.
Regardless, thank you so much.