Home > Electronics Tutorials > C Language Tutorial > Statements - return

C Language Programming Library Reference Guide

Statements - return

The return statement causes the current function to terminate. It can return a value to the calling function. A return statement can not appear in a function whose return type is void. If the value returned has a type different from that of the function's return type, then the value is converted. Using the return statement without an expression creates an undefined result. Reaching the } at the end of the function is the same as returning without an expression.

Syntax:

return expression; Examples:
int alice(int x, int y)
 {
  if(x<y)
    return(1);
  else
    return(0);
}
Note: To report broken links or to submit your projects, tutorials please email to Webmaster

Discover

     more......