Importance of "auto" specifier

Options
- Automatically initializes a variable to NULL.
- Automatically initializes a variable to 0;.
- Automatically increments the variable when used.
- Indicates that a variable's memory space is allocated upon entry into the block.
- Indicates that a variable's memory will automatically be preserved.


CORRECT ANSWER : Indicates that a variable's memory space is allocated upon entry into the block.

Discussion Board
Explanation-

Answer is, option four i.e Indicates that a variable's memory space is allocated upon entry into the block.

“auto” variables are declared at the start of a program’s block i.e in the curly braces ( { } ). 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 (by variable name) but, 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 to use the keyword auto because by default, storage class within a block is auto.


Sapna 02-26-2017 11:22 PM

auto specifier in c

fourth option is right ..auto variables memory is allocated at the time of define the variable

nagaraju 02-14-2017 08:15 AM

data srtucture

You specified the very nice multiple choice questions thank you!

korina 08-5-2015 02:09 AM

Answer is wrong

Fourth option is the best description of auto!

Sam 06-21-2014 03:49 AM

Auto specifier in C

I find the given "correct" answer to be vague and missing the point. The fourth answer is closer to the meaning, though incomplete. An automatic ("auto") variable is a variable which is allocated and deallocated automatically when program flow enters and leaves the variable's context (e.g., function or block). Generally, all local variables are "auto" by default.

gds 05-18-2014 03:15 AM

Auto specifier in C

- auto storage-class specifier - It declares an automatic variabl which has a local lifetime.

Aparna 07-5-2013 06:33 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement