C++ provides the ability to supply a default value for an argument to a function. Now when a function is called, a programmer has the option of either using the default value or supplying their own value to use.
To use the default value, the function will be called without supplying an argument.
Function Prototype: return_type func_name(arg_type = default_value); Function Header: return_type func_name(arg_type arg_name) Function Calls: func_name(); //default value is used func_name(arg1); //value in arg1 is used
Default arguments must be the rightmost arguments in an argument list
If an omitted argument is NOT the rightmost in the argument list, all arguments to the right must also be omitted
Default arguments must be specified with the first occurrence of the function name