This article is about Automatic variables. For the C++ keyword auto used for type inference, see C++11 § Type inference.
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,[note 1] 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.[note 2] Automatic local variables are normally allocated in the stack frame of the procedure in which they are declared.[note 3] This was originally done to achieve re-entrancy and allowing recursion,[note 4] 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.
Cite error: There are <ref group=note> tags on this page, but the references will not show without a {{reflist|group=note}} template (see the help page).
and 19 Related for: Automatic variable information
programming, an automaticvariable is a local variable which is allocated and deallocated automatically when program flow enters and leaves the variable's scope...
finmath-lib stochastic automatic differentiation, Automatic differentiation for random variables (Java implementation of the stochastic automatic differentiation)...
entire run of the program. This is in contrast to shorter-lived automaticvariables, whose storage is stack allocated and deallocated on the call stack;...
language, an external variable is a variable defined outside any function block. On the other hand, a local (automatic) variable is a variable defined inside...
controls, and a torque converter. Other types of automatic transmissions include continuously variable transmissions (CVT), automated manual transmissions...
2020 Automatic transmission, or a car with an automatic transmission Automatic Knives Automatic firearm AutomaticvariableAutomatic watch Automatic (automobile...
languages provide lexically scoped local variables. In most languages, local variables are automaticvariables stored on the call stack directly. This...
A continuously variable transmission (CVT) is an automated transmission that can change through a continuous range of gear ratios. This contrasts with...
lifetime coincides with variable lifetime of a variable with that object as value (both for static variables and automaticvariables), but in general, object...
Electronic Suspension Control System (ESCS), meaning to improve the AutomaticVariable Damping System (AVDS) suspension from the original GPZ. The GPX had...
case of automaticvariables. RAII ties resources to object lifetime, which may not coincide with entry and exit of a scope. (Notably variables allocated...
EDVAC (Electronic Discrete VariableAutomatic Computer) was one of the earliest electronic computers. It was built by Moore School of Electrical Engineering...
A random variable (also called random quantity, aleatory variable, or stochastic variable) is a mathematical formalization of a quantity or object which...
1999[clarification needed] European Automatic Track Gauge Changeover Systems, UIC-backed study of different variable gauge systems Talgo's variable gauge system explained...
environment variable is a user-definable value that can affect the way running processes will behave on a computer. Environment variables are part of...
adjustment can be manual or automatic. The manual type is applicable only for relatively low voltage and is known as a variable AC transformer (often referred...
Variable air volume (VAV) is a type of heating, ventilating, and/or air-conditioning (HVAC) system. Unlike constant air volume (CAV) systems, which supply...
The M27 Infantry Automatic Rifle (IAR) is a 5.56mm, select-fire assault rifle, based on the HK416 by Heckler & Koch. It is used by the United States Marine...
program; automatic-duration variables are allocated on the stack and come and go as functions are called and return. For static-duration and automatic-duration...