The purpose of default arguments is to avoid some tedious coding.
Let's say for example that you are writing the function:
Let's assume in your code, you call logorithm() many times, but usually you want to call it with base 10.
double logarithm(double x, double base)
You might see it is rather redundant to keep writing the '10' as an additional parameter.
double value1 = logarithm(3, 10);
double value2 = logarithm(4, 10);
double value3 = logarithm(123, 10);
Therefore, you might find it in your best interest to write the 'double base' parameter as
a default parameter.
What this code says is: "This function is called logarithm which takes 2 parameters: a double
double logarithm(double x, double base = 10)
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:
double value1 = logarithm(3); // assumed base 10.
double value2 = logarithm(4); // assumed base 10.
double value3 = logarithm(123); // assumed base 10.