Share via


Automatic

Objects and variables with automatic storage are local to a given instance of a block. In recursive or multithreaded code, automatic objects and variables are guaranteed to have different storage in different instances of a block. Microsoft C++ stores automatic objects and variables on the program's stack.

Objects and variables defined within a block have auto storage unless otherwise specified using the extern or static keyword. Automatic objects and variables can be specified using the auto keyword, but explicit use of auto is unnecessary. Automatic objects and variables have no linkage.

Automatic objects and variables persist only until the end of the block in which they are declared.

See Also

Reference

C++ Storage Classes

auto Keyword