References as Results
References can also be used as a result type for a function.
2 reasons for doing so:
- A reference can be used as the target of an assignment. Therefore, a function call that returns a reference can be used on the left side of an assignment.
- Returning a reference is more efficient than returning a value. Therefore, large values can be returned by reference.