Default function arguments in C++

A function can assign a default value to a parameter when no argument is specified in the function call.

For Example:


It is generally used to handle complex programs.  Here is an example of usage of default function arguments:

#include <iostream>

using namespace std;

void clrscr(int s=20);

int main()


register int x;

for(x=0; x<25; x++ ) cout << x << endl;



return 0;


void clrscr(int s)


for(; s; s–) cout << endl;


Leave a Reply