What are default arguments in C++ with example

The value that is provided in the declaration of the function itself is called a default argument.
These default values are assigned automatically to the function by the compiler.

We will look into the sample program below:

In the above program there is no need to write 3 sum functions, only one function works by using default values for 3rd and 4th arguments.

Output of the above program is:

The default arguments should pass like all subsequent arguments must have default value.