DekGenius.com
Team LiB   Previous Section   Next Section
return statement Returns from a function

statement := return [expression] ;

The return statement returns control from a function to its caller. If the function returns void, the expression is typically omitted, or else expression must be of type void. If the function returns a non-void type, the expression must be convertible to the return type.

A function that returns non-void must have a return statement (except for main, which has an implicit return 0; if control reaches the end of the function).

See Also

expression, statement, Chapter 5

    Team LiB   Previous Section   Next Section