How can one print the return value of a function? For example, you have an 'Add' function which returns the sum of two argument integers. However, when you return a value, and run the function, the value is not printed. So what is the best way to print such a value?
I know I could do this, but I don't want to:
I tried 'couting' a function with a return value, and this works, but is this legal?Code:
int Add(int num1, int num2)
cout << sum;