Default function argument means to fix the value of one or more than one function parameters which you expect, will remain same in the entire or most of the program. For example you have a function named table() which takes two parameters number and upperlimit. Number is the value you want to print table of, and upperlimit contains the value upto which you want the table to be. In this case you will know that most of the time the value of upperlimit will be same i.e. 10, so you can fix this value.View more random threads:
- what is the meaning of sibling?as it is mentioned in...
- how to use Binary operators in c++ 2011
- Different syntax? in c++ 2011-12
- Initilization of Data Member in c++ 2011
- I would able to program in c++ I would be able to program...
- what does it mean " this->object=object"?
- Boolean data problem in c++ 2011-12
- What is the purpose of using classes if we have the...
- we will apply single rotation and which will apply double...
- cs201 intro to computer
table(int number, int upperlimit = 10);
Now whenever you call this function, the value of upperlimit will be 10 by default.
You can also call this function by only giving the parameter value for number variable only.
Sponsored Links
There are currently 1 users browsing this thread. (0 members and 1 guests)