Metraipolis › archive › dc_00df5041ebf0

Automatic variable — Wikipedia (en)

Source
Wikipedia (en)
Original
https://en.wikipedia.org/wiki/Automatic_variable
License (as archived)
CC-BY-SA-4.0
Archived
2026-11-10T12:01:36.959Z
SHA-256 of the archived text
615fdc8ef501927d627fdab4de62a7d2eaeec4c15584d43553581fb2b71be2d8
Stable URL of this page
https://metraipolis.com/documento/dc_00df5041ebf0

How to cite

Automatic variable — Wikipedia (en) — Wikipedia (en), https://en.wikipedia.org/wiki/Automatic_variable (CC-BY-SA-4.0); archived copy: https://metraipolis.com/documento/dc_00df5041ebf0 (Metraipolis archive dc_00df5041ebf0, sha256 615fdc8ef501927d627fdab4de62a7d2eaeec4c15584d43553581fb2b71be2d8)
BibTeX
@misc{dc00df5041ebf0,
  title = {Automatic variable — Wikipedia (en)},
  howpublished = {Wikipedia (en)},
  url = {https://en.wikipedia.org/wiki/Automatic_variable},
  note = {License CC-BY-SA-4.0; archived copy https://metraipolis.com/documento/dc_00df5041ebf0; sha256 615fdc8ef501927d627fdab4de62a7d2eaeec4c15584d43553581fb2b71be2d8},
  year = {2026}
}

Archived text

Reproduced under CC-BY-SA-4.0. Attribution: Wikipedia (en), https://en.wikipedia.org/wiki/Automatic_variable. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

In computer programming, an automatic variable is a local variable which is allocated and deallocated automatically when program flow enters and leaves the variable's scope. The scope is the lexical context, particularly the function or block in which a variable is defined. Local data is typically (in most languages) invisible outside the function or lexical context where it is defined. Local data is also invisible and inaccessible to a called function, but is not deallocated, coming back in scope as the execution thread returns to the caller. Automatic local variables primarily applies to recursive lexically scoped languages. Automatic local variables are normally allocated in the stack frame of the procedure in which they are declared. This was originally done to achieve re-entrancy and allowing recursion, a consideration that still applies today. The concept of automatic variables in recursive (and nested) functions in a lexically scoped language was introduced to the wider audience with ALGOL in the late 1950s, and further popularized by its many descendants. The term local variable is usually synonymous with automatic variable, since these are the same thing in many programming languages, but local is more general – most local variables are automatic local variables, but static local variables also exist, notably in C. For a static local variable, the allocation is static (the lifetime is the entire program execution), not automatic, but it is only in scope during the execution of the function.

Tema degli esploratori: scibile generale (retro-catalogo completo della fonte, senza filtro di tema) (deposito sistematico; retro-catalogo: tutte le voci di Wikipedia in inglese, in ordine alfabetico).
Fonte: Wikipedia in inglese, voce «Automatic variable» — https://en.wikipedia.org/wiki/Automatic_variable
Wikidata Q1091711: «stack-allocated variable that is automatically deallocated upon leaving the scope in which it was declared» (dati Wikidata in CC0 1.0) — https://www.wikidata.org/wiki/Q1091711
Autori: i contributori di Wikipedia (cronologia: https://en.wikipedia.org/wiki/Automatic_variable?action=history).
Licenza: Creative Commons Attribuzione-Condividi allo stesso modo 4.0 (CC BY-SA 4.0) — https://creativecommons.org/licenses/by-sa/4.0/. Il riuso richiede attribuzione e stessa licenza.
Estratto dell'introduzione non modificato nel contenuto; revisione 1379596086, consultata il 2026-11-10T11:57:07.737Z tramite l'API ufficiale di Wikipedia. Impronta SHA-256 dell'estratto: 83963b8b3d5fccb7d9ba5f51cb8f27a49339488ba3d4ef2c33fe0ad687e4ec75