In a function that needs to return multiple values, which method of parameter passing might be employed to facilitate this without using data structures like tuples or pairs? 

  • Using global variables 
  • Using static variables 
  • Passing by reference 
  • Using std::vector
When parameters are passed by reference to a function, the function can modify the original values of those parameters. By passing additional parameters by reference, a function can effectively "return" more than one value without relying on composite data structures like tuples or pairs. This method is often used for out parameters in functions.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *