The purpose of default arguments is to avoid some tedious coding.

Let's say for example that you are writing the function:

Code:

double logarithm(double x, double base)

Let's assume in your code, you call logorithm() many times, but usually you want to call it with base 10.

Code:

double value1 = logarithm(3, 10);
double value2 = logarithm(4, 10);
double value3 = logarithm(123, 10);

You might see it is rather redundant to keep writing the '10' as an additional parameter.

Therefore, you might find it in your best interest to write the 'double base' parameter as

a *default parameter*.

Code:

double logarithm(double x, double base = 10)

What this code says is: "This function is called logarithm which takes 2 parameters: a double

named x, and another double named base. If a call to logarithm omits the second parameter,

then treat it as if he/she passed a 10."

This way, calls to logarithm can be:

Code:

double value1 = logarithm(3); // assumed base 10.
double value2 = logarithm(4); // assumed base 10.
double value3 = logarithm(123); // assumed base 10.