Sunday, December 25, 2011

auto storage class in c

Automatic Variables

They are declared at the start of a block. Memory is allocated automatically upon entry to a block and freed automatically upon exit from the block. The scope of automatic variables is local to the block in which they are declared, including any blocks nested within that block. For these reasons, they are also called local variables. No block outside the defining block may have direct access to automatic variables, i.e. by name. Of course, they may be accessed indirectly by other blocks and/or functions using pointers.

Automatic variables may be specified upon declaration to be of storage class auto. However, it is not required; by default, storage class within a block is auto. Automatic variables declared with initializers are initialized each time the block in which they are declared is entered.

See Also:

No comments:

Post a Comment