Share via


return Statement

return [expression];

The return keyword terminates execution of the function in which it appears and returns control (and the value of expression if given) to the calling function. A function returns an integer value by default. To define other types of return values, the name of the function is preceded by the type. If the function is type void, the return statement is omitted.

Example

In the following example, a simple function with no parameters returns integer 0:

// Examples of the return statement
cypher()
   {
   return(0);
   }

In the following example, a simple function with no parameters returns a double value:

double fMultip()
   {
   double a;
   a = 4 * 3;
   return (a);
   }