*** Welcome to piglix ***

Return address (computing)


In computer programming, a return statement causes execution to leave the current subroutine and resume at the point in the code immediately after where the subroutine was called, known as its return address. The return address is saved, usually on the process's call stack, as part of the operation of making the subroutine call. Return statements in many languages allow a function to specify a return value to be passed back to the code that called the function.

In C++, return exp; (where exp is an expression) is a statement that tells a function to return execution of the program to the calling function, and report the value of exp. If a function has the return type void, the return statement can be used without a value, in which case the program just breaks out of the current function and returns to the calling one.

In Pascal there is no return statement. (However, in newer Pascals, the Exit(exp); can be used to return a value immediately. Without parameters, it just breaks out the procedure.) A subroutine automatically returns when execution reaches its last executable statement. Values may be returned by assigning to an identifier that has the same name as the subroutine, a function in Pascal terminology. This way the function identifier is used for recursive calls and as result holder; this is syntactically similar to an explicit output parameter. The same syntax is used in Fortran 66 and Fortran 77. In some other languages a user defined result variable is used instead of the function identifier.

Oberon (Oberon-07) has a return clause instead of a return statement. The return clause is placed after the last statement of the procedure body. This enables compile-time checking of proper return and return value from the procedure.


...
Wikipedia

...