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:
- how often do we require to use inline functions and macros....
- why we use pointers or reference except using real name of...
- What is the object state. in c++ 2011
- What data type will be used in C++ program?
- Pointers in c++ 2011
- using namespace std;"in the code can we compile the...
- why we use inline function if there are simple function...
- A partial specialization may inherit from an ordinary class
- Within our assignment code, can we replace <iostream.h>...
- write a function to calcute the power of some number, will...
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)