Illustrates default argument list. - C++ Function

C++ examples for Function:Function Parameter

Description

Illustrates default argument list.

Demo Code

#include <iostream>
using namespace std;
void pr_msg(char note[]="default value"); // Prototype.
void main()//  www  .  j a  va 2 s.  c om
{
   pr_msg();          
   pr_msg("A new message");  
   pr_msg();                 
   return;
}
void pr_msg(char note[]) 
{
   cout << note << "\n";
   return;
}

Result


Related Tutorials