33. What is a default argument? Give example
3 marks
Answers
Answered by
1
Answer:
Default arguments are overwritten when calling function provides values for them. For example, calling of function sum(10, 15, 25, 30) overwrites the value of z and w to 25 and 30 respectively. ... For example, the following function definition is invalid as subsequent argument of default variable z is not default
Answered by
0
Answer: A default argument is a value provided in a function declaration that is automatically assigned by the compiler if the caller of the function doesn’t provide a value for the argument with a default value.
Following is a simple C++ example to demonstrate the use of default arguments. We don’t have to write 3 sum functions, only one function works by using default values for 3rd and 4th arguments
Explanation:
Similar questions