+ 3

Returning values of functions

Is it possible to return two values in a function at the same time in c++. If yes,please explain how. EXAMPLE: Int func(){ Int a=2; Int b=6; Return a; Return b; }

3rd Jul 2018, 4:03 AM
Shaun Nunoo
Shaun Nunoo - avatar
2 Respuestas
+ 4
These are some many ways to modify/return multiple values in a single function. https://dzone.com/articles/returning-multiple-values-from-functions-in-c The easiest and the one I've personally used is calling functions by reference.
3rd Jul 2018, 5:16 AM
Rusty.Metal
+ 2
a simple solution is return values in array
9th Jul 2018, 10:15 PM
Ali Reza Riahi
Ali Reza Riahi - avatar