Namespaces
Variants
Views
Actions

return statement

From cppreference.com
< c‎ | language
Revision as of 18:34, 31 May 2013 by P12bot (Talk | contribs)

Terminates current function and returns specified value to the caller function.

Contents

Syntax

return expression (1)
return (2)

Explanation

The first version evaluates the expression, terminates the current function and returns the result of the expression to the caller function. The resulting type of the expression must be convertible to function return type.

The second version terminates the current function. Only valid if the function return type is void.

Keywords

return

Example