# What does “dummy argument” mean?

What is does it mean when an argument to a function is called a dummy argument? I have not encountered this term outside Fortran, is it a general term in computer science? What would be examples of arguments passed as dummy and not passed as dummy?

I found this definition, which I am not sure that I understand, but it sounds like a dummy argument is a variable that is passed by reference, in which case in Fortran all variables are dummy variables? (confused)

Edit: I just run into the following essay which helped me to understand better Fortran's argument/function calling teminology: Dortor Fortran: I've come here for an argument

## "Dummy" as "unused"

In general (not in Fortran) a dummy argument is an argument that will not be used by the body of the function.

For example, in the following function, z is a dummy argument but x and y are not.

int f(int x, int y, int z) {
return (x + y);
}


They can be used for several reasons:

• depending on another argument or some configuration, the argument will be used (not dummy) and sometimes it won't (dummy) but the programming setting imposes to pass an argument anyway. In that case, you can usually pass anything to the function, i.e. NULL or 0, depending on the setting;

• the argument is no more needed, but you have to give one for backward compatibility reasons;

• the function does not take any argument (it can be called a procedure) but the setting imposes to give at least an argument. You can find this in unpure functional programming languages but in general it is not called "dummy" because the type (unit in ocaml) suggests it.

## "Dummy" in Fortran and Pascal

In Fortran and Pascal, and probably in your case, there is a more obscure notion of passed-object dummy argument that I have failed to comprehend. But it seems to concerns more the specification than the actual argument-passing procedure. (Some explanations: link 1 with both languages, link 2 in French).

I don't know if this notion is still used.

## "Dummy" as "bound"

I would not advise this terminology in any case, but "dummy variable" can mean "bound variable" but this notion is more of a math and computer science thing.

• My understanding (note: I know French and programming language semantics but not Fortran) is that “dummy argument”, in all 3 links in your Fortran/Pascal section, means an argument that is a local name for an object passed by reference. – Gilles 'SO- stop being evil' Sep 9 '12 at 18:52

In fortran a dummy argument is what other languages refer to as a formal argument. So the dummy arguments are the list of arguments in the function (or subroutine) definition.

The actual arguments are the list of arguments in the calling list, at the point in the source code where a function is called (ie used).

• This is the only correct answer here regarding the Fortran meaning. – Vladimir F Jul 23 '15 at 14:52

A function is a well defined as: relation between a set of inputs and a set of permissible outputs. A dummy variable would be any input that had no effect on the output.

In "C" the time function takes a pointer to a time_t object as input. As this pointer is only used to get output it could be considered a "dummy variable".

• wouldn't it be more accurate to call it an output variable? In fact, in some settings (e.g. in C#), it would actually be given the "out" keyword to label it as an out parameter. – Joe Sep 11 '12 at 22:41

A dummy argument is actually an argument in a function which is not been used in the function but rather it is substituted in the function expression when it is referenced