Content deleted Content added
No edit summary |
GreenC bot (talk | contribs) Rescued 1 archive link. Wayback Medic 2.5 per Category:All articles with dead external links - pass 4 |
||
(One intermediate revision by one other user not shown) | |||
Line 1:
{{short description|Programming variable that persists for the lifetime of the program}}
{{see also|Static (keyword)}}
In [[computer programming]], a '''static variable''' is a [[variable (programming)|variable]] that has been [[memory allocation|allocated]] "statically", meaning that its [[variable lifetime|lifetime]] (or "extent") is the entire run of the program. This is in contrast to shorter-lived [[automatic variable]]s, whose storage is [[stack allocation|stack allocated]] and deallocated on the [[call stack]]; and in contrast to [[
[[Variable lifetime]] is contrasted with [[Scope (computer science)|scope]] (where a variable can be used): "global" and "local" refer to scope, not lifetime, but scope often implies lifetime. In many languages, [[global variable]]s are always static, but in some languages they are dynamic, while [[local variable]]s are generally automatic, but may be static.
Line 11:
| title = What is static memory allocation and dynamic memory allocation?
| quote = The compiler allocates required memory space for a declared variable. By using the addressof operator, the reserved address is obtained and this address may be assigned to a pointer variable. Since most of the declared variables have static memory, this way of assigning pointer value to a pointer variable is known as static memory allocation. Memory is assigned during compilation time.
| url = http://www.merithub.com/q/58-static-memory-allocation-dynamic-memory-allocation.aspx
==History==
|