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


4 Answers 4


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).


"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.

  • $\begingroup$ 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. $\endgroup$ Sep 9, 2012 at 18: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".

  • $\begingroup$ 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. $\endgroup$
    – Joe
    Sep 11, 2012 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

  • $\begingroup$ Hi. Thanks for the answer, but what new does it bring on top of the existing answers? See our FAQ and how to wirte a good answer FAQ. $\endgroup$
    – Ran G.
    May 28, 2015 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.