Automatic variable

From Wikipedia, the free encyclopedia

[edit] In the C programming language

Variables declared within a block of code are, by default, automatic variables. This means that when the block is entered during program execution, the automatic variables will be automatically allocated; when the block is exited, the automatic variables will be de-allocated. The keyword (the storage class) used to declare automatic variables is auto, but this is the default (making the keyword superfluous). An automatic variable will have an undefined value when declared, so it is important to initialize it with a valid value before using it.

The term local variable is usually synonymous with automatic variable - since these are the same thing in most programming languages.

[edit] See also


Languages