Ques : What is Automatic Variable ?

Ans :

The variables local to a function are automatic i.e., declared within the function. The scope of lies within the function itself. The automatic defined in different functions, even if they have same name, are treated as different. It is the default storage class for variables declared in a function.

Points to remember:
• The auto is optional therefore there is no need to write it.
• All the formal arguments also have the auto storage class.
• The initialization of the auto-variables can be done:

• in declarations
• using assignment expression in a function

• If not initialized the unpredictable value is defined.
• The value is not retained after exit from the program.

Leave a Reply