Zebra0.com

cppArguments must match

Arguments must match

If we have the function prototype someFunc(int); we can pass it any integer value. We could pass it an integer variable, or 36, or even some equation that has an integer value.

If we have the function prototype anotherFunc(double); we can pass it any numeric value. We could pass it an integer or double variable, or 36, or 36.8 or even some equation that has a numeric value.

When we use pass by reference, we can ONLY pass it a variable of the same type.

We can not call half(num1+num2); or half(12), because those arguments are not memory locations.

Only use pass by reference when you need to change the value of a variable.

NEXT: Exchanging two values