The correct answer is: B. The function header is considered a C++ statement, so it must end in a semicolon.
A function header is a declaration of a function. It tells the compiler the name of the function, the type of data it returns, and the types of data it takes as arguments. The function header is not a statement, so it does not need to end in a semicolon.
Here is an example of a function header:
int add(int a, int b) {
return a + b;
}
The function header in this example declares a function called add
. The function takes two int
arguments and returns an int
value. The function body is enclosed in curly braces.
Here is an example of a function statement:
int x = add(1, 2);
The function statement in this example calls the add
function and assigns the return value to the variable x
.
I hope this explanation is helpful. Please let me know if you have any other questions.