Lets pretend that there is no operator+ and we have to use a function.
Lets call it 'sum'. The 'sum' shall compute the sum of two values.
Lets use it: c = sum( a, b );
Can we do that?
Can a function return a value that we can store to variable 'c'?
If we cannot do that, then how do we get the result from the function?
Foo sum( const Foo& lhs, const Foo& rhs )
{
Foo result = lhs;
// somehow add rhs to the result
return result;
}
(The Foo is some type.)
Then we use the function:
1 2 3 4 5
Foo a;
Foo b;
Foo c;
// set values of a and b
c = sum( a, b );
What we return from the function depends on what is/has the value that the function must return.
You have probably seen return 0; in function main(). The main() should return a small (preferably < 128) non-negative integer. If the value is 0, it is interpreted as success. All other values are error codes that can tell how the program failed.