Content deleted Content added
Hervegirod (talk | contribs) fix wikilink |
|||
Line 1:
In [[computer science]], a '''local variable''' is a [[variable]] that is given ''local [[scope (programming)|scope]]''. Such a variable is accessible only from the [[Subroutine|function]] or [[Statement block|block]] in which it is declared. Local variables are contrasted with [[global variables]].
In most languages, local variables are [[automatic variable]]s stored on the [[call stack]] directly. This means that when a [[Recursion (computer science)|recursive function]] calls itself, local variables in each instance of the function are given separate memory [[address space]]. Hence variables of this scope can be declared, written to, and read, without any risk of [[Side-effect (computer science)|side-effects]] to processes outside of the block in which they are declared.
|