DEFAULT ARGUMENTS
For Example:
int hello(int a=10, float b=5.2, char c='v')
{
.
.
.
}
Now, Calling the Function in Main.
cout<<hello(20, 6.3);
This statement will run the 'hello' Function and will invoke the Values 20,6.3, v respectively.
cout<<hello(30);
This statement will run the 'hello' function and will invoke the Arguments Values 30,5.2,v respectively.
Just Like the above Example if the Values of the Function's Arguments is not specified in the Main during the Calling then it Uses the Default Values given to it.
No comments:
Post a Comment