This bit of code comes from the function1 tutorial (excellent btw). My question is- What is the purpose of this variable? Can the function NOT have its output assigned to a variable? I want to understand what's essential to have a function, and I'm not sure that this variable is.
int addition (int a, int b)
{
int r; // this is the variable I'm asking about
r=a+b; // can this be done without putting it into a variable
return (r); //can return simply return the output of a+b?
}
int main ()
{
int z;
z = addition (5,3);
cout << "The result is " << z;
return 0;
}