Home Segments Index Top Previous Next

104: Mainline

Because display_trade_price has no return statement, it is said to fall off its end, returning nothing, which is allowed for only those functions that have a void return type.

Some programmers think it inelegant to have functions that fall off their ends. Accordingly, those programmers write empty return statements, as in the following amended version of display_trade_price:

void display_trade_price (double p, int n) { 
  printf ("The total value of the trade is %f.\n", p * n); 
  return; 
}