Question #172419

Write an inline function sum() with four parameters that calculates the

arguments

provided and returns their sum.

Parameters: Four variables of type long.

Returns: The sum of type long.

Use the default argument 0 to declare the last two parameter.


Expert's answer

inline long sumOfFour(long a, long b, long c = 0, long d = 0)
{
    return a + b + c + d;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS