That is a default value for z. Thus, you can call the function with just two arguments, and z will be assigned the value 1. If a third argument is passed to the function, z will be assigned that value.


Actually it is not function overloading. In Function overloading the return type and argument type is often different. It is more versatile and a different defination(i.e. different sets of instruction for same function) is been called.
Wherein in the default argument, only one defination is there. The default argument are optional.If they are not specified,the compiler specifies them by default.

Remember all the default argument should be placed from right. i.e. func(int x, int z=1, int y) is not allowed. int z=1 should be on the right.

This question has already been answered. Start a new discussion instead.