#include <iostream> using namespace std; int sum(int a, int b=10, int c=20); int main(){ /* In this case a value is passed as * 1 and b and c values are taken from * default arguments. */ cout<<sum(1)<<endl; /* In this case a value is passed as * 1 and b value as 2, value of c values is * taken from default arguments. */ cout<<sum(1, 2)<<endl; /* In this case all the three values are * passed during function call, hence no * default arguments have been used. */ cout<<sum(1, 2, 3)<<endl; return 0; } int sum(int a, int b, int c){ int z; z = a+b+c; return z; }
Tuesday, 14 May 2019
Default Arguments in C++ Functions
Subscribe to:
Post Comments (Atom)
Directory implementation
The selection of directory-allocation and directory-management algorithms significantly affects the efficiency, performance, and reliabil...

-
A stream is a name given to a flow of data at the lowest level. At the lowest level, data is just the binary data without any notion of da...
-
#include <iostream> using namespace std; const int Inng = 2; const int Player = 11; int main() {int inngtotal=0; int scor...
No comments:
Post a Comment