Functions – Return statement

Values are returned by using the return statement. The type returned must match the return type as specified in the function definition. The return statement causes the function to end its execution immediately and pass control back to the line from which it was called. See return() for more information.

  real square (real num)  {     return(num*num);  }    b=square (4);   // b=16;  

You can’t return multiple values from a function, but similar results can be obtained using an array as an argument or by specifying arguments as call-by-reference.

Returning Values