0
Plz try
Can we get both sum and product of two integers by calling a single function?
2 Answers
+ 6
You mean like this?
struct ReturnInfo
{
int sum;
int product;
};
ReturnInfo SumAndProduct(int a, int b)
{
ReturnInfo returnInfo.
returnInfo.sum = a + b;
returnInfo.product = a * b;
return returnInfo;
}
+ 3
Actually you cant. If you want direct results, it is impossible.
However there is a workaround, as explained by __IAS__. This way you ask a function to obtain a result set which includes all the values or properties required.