Namespaces
Variants
Views
Actions

return statement

From cppreference.com
< c‎ | language
Revision as of 21:19, 2 November 2012 by P12bot (Talk | contribs)

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

Contents

Syntax

return Template:sparam (1)
return (2)

Explanation

The first version evaluates the Template:sparam, terminates the current function and returns the result of the Template:sparam to the caller function. The resulting type of the Template:sparam 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