+ 1
How can we return multiple values to a function?
8 Answers
+ 5
you can use a struct or pointer to return multiple values from a function
+ 4
Using pointers u can pass multiple parameters (i. e. Value of call by reference) and u can return multiple values also...
+ 2
CarrieForle, wait. Was he talking about *passing arguments*?
// multiple args
int AddTwoNums(int a, int b)
{
return a+b;
}
+ 1
You can only return one value with a function. Though if you want to return multiple, you can pack them into an array or hashtable and return that
+ 1
It means i can't use functions to swap multiple values?
+ 1
You cant *return* multiple values from a function. You *can* change global variables
+ 1
Thank you...