in a function how do you return multiple values to the main function.
A tuple or struct instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
struct MultipleVar
{
int val1;
string val2;
double val3;
};
MultipleVar Function(void)
{
MultipleVar Ret;
Ret.val1 = 42;
Ret.val2 = "Empty";
Ret.val3 = 2.718281828459;
return Ret;
}
|
http://www.cplusplus.com/doc/tutorial/structures/
Last edited on