Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
12 user(s) are online (10 user(s) are browsing encyclopedia)

Members: 0
Guests: 12

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

Default argument

In computer programming, a default argument is an argument to a function (programming) that a programmer is not required to specify.

In most programming languages, functions may take one or more arguments. Usually, each argument must be specified in full (this is the case in the C programming language).

Later languages (for example, in C plus plus) allow the programmer to specify default arguments that always have some value, even if the calling program do not write them. For example, in the following function definition:

int MyFunc(int a, int b, int c=12);

this function takes three arguments, of which the last one has a default of twelve. The programmer may call this function in two ways:

result = MyFunc(1, 2, 3);

result = MyFunc(1, 2);

In the first case the value for the argument called c is specified as normal. In the second one, the argument is omitted, and the default 12 value will be used instead.

The called function has no way of knowing if the argument has been specified by the caller or using the default value.