Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>return return statement</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
return                   return Statement

 return [expression];

    The return statement is used to terminate a function and return
    control to the statement following the call.  The return statement
    may also be used to return a value.

      Notes:    If no value is returned, the return value is undefined.

                Although it is a bad programming practice, it is possible
                to return from multiple places in a function, returning a
                value from some points, but not from others.  This is
                sure to bite you at some later time, and should be
                avoided.

                The return expression is often written as return(value).
                The parentheses aren't necessary--but they don't hurt
                anything.

                A function may not return an array or another function.
                It may, however, return a pointer to an array or
                function.  Most C compilers, including MS-C and Turbo C,
                allow you to return structures and unions.

                If the type of a function is other than `int', be sure to
                declare the return type before you call the function.
                Otherwise the return value will be treated as type `int'.

  -------------------------------- Example ---------------------------------

           if (condition)
               return;                /* Return value undefined */


           if (condition)
               return i;              /* Value of i is returned */


           if (condition)
               return(i);             /* As above; value of i is returned */

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson