return

1.6.9 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);
}
Bu yazı Şartlar kategorisine gönderilmiş ve , , , , , , , , , , , , , , , , , , ile etiketlenmiş. Kalıcı bağlantıyı yer imlerinize ekleyin.