1- A function parameter is a variable used in a function where the value is provided by the caller of the function. Function parameters are placed in between the parenthesis after the function identifier, with multiple parameters being separated by commas.
2- Parameters are the key mechanism by which functions can be written in a reusable way, as it allows them to perform tasks without knowing the specific input values ahead of time. Those input values are passed in as arguments by the caller.
Quiz:
1- Multiply function is defined as void type but it returns a value and therefore it produces a compile error.
2- Multiply is defined with two input parameters but has been called with one argument that doesn’t match the parameters and makes a compile error.
3- 24
4-
int doubleNumber(int x) {
return 2 * x;
}
5-
#include
int doubleNumber(int x) {
return 2 * x;
}
int main()
{
int x=0;
std::cout <<"Enter an integer number : "<< std::endl;
std::cin >>x
std::cout << doubleNumber(x) << std::endl;
return 0;
}