return statement

   
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

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net