A C or C++ function can only "return" one value, declared as the return value in the function prototype. In reality, you can pass arguments as pointers (or by "reference" if you prefer C++ nomenclature) to local variables which will take on a value after the function returns.
Ie:
Code:
void area(int length, int width, int *area)
{
*area = length * width;
}
I'm a little shaky on C++ code but you could do the same using references...
Code:
void area(int L, int W, int &Area)
{
Area = L * W;
}
I'd think either would work...
SOrry for the C++ code. In C++, the & operator can have a different meaning depending on context.
Just check out the first example...