void print_msg( void );
int main( void )
{
print_msg( “This is a message to print” );
return 0;
}
void print_msg( void )
{
puts( “This is a message to print” );
return 0;
}
5.BUG BUSTER:What’s wrong with the following function definition?
int twice(int y);
{
return (2 * y);
}
- Rewrite Listing 5.4 so that it needs only one returnstatement in the larger_of()
function. - Write a function that receives two numbers as arguments and returns the value of
their product. - Write a function that receives two numbers as arguments. The function should
divide the first number by the second. Don’t divide by the second number if it’s
zero. (Hint: Use an ifstatement.) - Write a function that calls the functions in exercises 7 and 8.
- Write a program that uses a function to find the average of five type floatvalues
entered by the user. - Write a recursive function to take the value 3 to the power of another number. For
example, if 4 is passed, the function will return 81.
122 Day 5
09 448201x-CH05 8/13/02 11:15 AM Page 122