Char array getter

This is a discussion on Char array getter within the C++ Programming forums, part of the General Programming Boards category; Well, given the prototype "void GetLastName( Name lastName )", it seems reasonable to expect that the name will be copied ...

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

This isn't really a getter function per se. It's more like a retrieval function or something. It's a getter but because of language syntax you have to pass in an argument and have that filled in, rather than returning the value. Same thing if you'd wanted to return two values: functions are only allowed to return one value so you might have to do

Like I said, you could write your particular getter without a parameter by returning a pointer instead, but if you're just learning about arrays now then the instructor might not have wanted to go into details about having to preserve the scope of the variable you're returning, etc.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

Okay I think I understand it all now! Thanks for all the help I think I would have been stuck for a long time if you didn't help! We have learned arrays just he likes making things difficult for us that's all!