A function that is prototyped as double calculate(int num); may ______

receive a double constant such as 3.9
receive a double variable
either (a) or (b)
neither (a) nor (b)

The correct answer is: C. either (a) or (b).

A function that is prototyped as double calculate(int num); may receive a double constant such as 3.9 or a double variable.

A function prototype is a declaration of a function that tells the compiler the name of the function, the type of data it returns, and the types of data it expects as arguments. In this case, the function calculate() returns a double and expects an int as an argument.

A double constant is a value that is stored as a double type. For example, the value 3.9 is a double constant.

A double variable is a variable that can store a double value. For example, the variable x could be declared as a double variable.

The function calculate() can be called with either a double constant or a double variable as an argument. For example, the following code calls calculate() with the double constant 3.9 as an argument:

double result = calculate(3.9);

The following code calls calculate() with the double variable x as an argument:

double result = calculate(x);

Exit mobile version