Actual parameters: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Nick Johnson
No edit summary
 
imported>Nick Johnson
(Redirecting to Actual parameter)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
In [[computer science]], an '''actual parameter''' is a name or value passed to a subroutine.  This is not to be confused with a [[formal parameter]], which is the name by which the subroutine refers actual parameter.  For example, in the [[C programming language]],
#REDIRECT [[actual parameter]]
 
<code>
int foo(int a)
{
    int b = 5;
 
    return a + b;
}
 
int bar(void)
{
    return foo(1);
}
</code>
 
 
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(). 
 
[[Category: Computers Workgroup]]
[[Category: CZ Live]]

Latest revision as of 14:18, 11 April 2007

Redirect to: