We are creating the world's most trusted encyclopedia and knowledge base.
Once you join us and log in, you'll be able to edit this page instantly!

Formal parameter

From Citizendium, the Citizens' Compendium

Jump to: navigation, search

Image:Statusbar3.png
Main Article
Talk
Definition [?]
Related Articles  [?]
Bibliography  [?]
External Links  [?]
 
This is a draft article, under development. These unapproved articles are subject to a disclaimer.

In computer science, a formal parameter is a name by which a subroutine refers to one of its parameters. This is not to be confused with an actual parameter, which is the name or value passed to the function by the caller. For example, in C,

int foo(int a)
{
   int b = 5;

   return a + b;
}

int bar(void)
{
   return foo(1);
}


The subroutine bar() calls foo(). When bar() calls foo(), it passes the constant 1. Within bar(), 1 is an actual parameter to foo(). Within foo(), a is a formal parameter which references the actual parameter 1 from bar().

Views
Personal tools