- Compound Operator
- Expression Operator
- Return Operator
- Conditional Operator if-else
- Ternary Operator ?:
- Switch Operator
- Loop Operator while
- Loop Operator for
- Loop Operator do while
- Break Operator
- Continue Operator
- Object Create Operator new
- Object Delete Operator delete
Return Operator
The return operator terminates the current function execution and returns control to the calling program. The expression calculation result is returned to the calling function. The expression can contain an assignment operator.
Example:
int CalcSum(int x, int y)
|
In functions with the void return type, the return operator without expression must be used:
void SomeFunction()
|
The right brace of the function means implicit execution of the return operator without expression.
What can be returned: simple types, simple structures, object pointers. With the return operator you can't return any arrays, class objects, variables of compound structure type.
See also
Initialization of Variables, Visibility Scope and Lifetime of Variables, Creating and Deleting Objects