Question: Functions Homework Functions Homework 1. Give the function header for each of the following functions. a) Function areaRectangle takes two double arguments, length and width,
Functions Homework


Functions Homework 1. Give the function header for each of the following functions. a) Function areaRectangle takes two double arguments, length and width, and retums a double value. b) Function max takes four integers, w, x, y, z, and returns an integer c) Function output Headers does not receive any arguments and does not return a value. d) Function getValue takes an integer argument, num, and returns a char. 2. Suppose that the function foo () has the following definition: int foo (int a, int b, int c) { Which are the following statements are legal? Assume that i has type int and x has type double. a) i = foo (10, 20, 30); b) x-foo (10, 20, 30); c) i - foo (5.25, 3.45, 7.22); d) x - foo (5.25, 3.45, 7.22); e) foo (10, 20, 30); f) foo (10, 20); 3. Which of the following would be valid prototypes for a function that returns nothing and has one double parameter? b) c) d) void foo (double *); void foo (double): void foo (x); foo (double x): 4. mp3s cost $1.25 each, CDs cost $3.25 each, and DVDs cost $12.75 each. Write a function, buyMusic, that takes three parameters representing the number of mp3s, CDs, and DVDs, and returns the total dollar cost
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
