A example of default arguments. : Function Arguments « Function « C++






A example of default arguments.

A example of default arguments.
 


#include <iostream>
using namespace std;

void f(int a=0, int b=0)
{
  cout << "a: " << a << ", b: " << b;
  cout << '\n';
}

int main()
{
  f();
  f(10);
  f(10, 99);

  return 0;
}

           
         
  








Related examples in the same category

1.Compute area of a rectangle using default arguments.Compute area of a rectangle using default arguments.
2.Use default argumentUse default argument
3.Default function arguments