Actual parameter: Difference between revisions
Jump to navigation
Jump to search
imported>Subpagination Bot m (Add {{subpages}} and remove any categories (details)) |
John Leach (talk | contribs) (flagged) |
||
Line 19: | Line 19: | ||
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(). | 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(). | ||
==References== | |||
{{reflist}} | |||
[[Category:Flagged for Review]] |
Revision as of 17:41, 16 March 2024
In computer science, an actual parameter is a name or value passed to a subroutine. This is in contrast to a formal parameter, which is the name by which the subroutine refers actual parameter. 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().