What is an auto variable in C ?

Sharad Jaiswal
Sharad Jaiswal

Posted On: Feb 22, 2018

 

All variables declared within a function are auto by default. The extent of a variable is defined by its scope. Variables declared auto can only be accessed only within the function or the nested block within which they are declared. They are created when the block is entered into and destroyed when it is exited. i.e., memory is allocated automatically upon entry to a block and freed automatically upon exit from the block and note that default value is a garbage value.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    C programming interview questions

    What are static variables in C ?

    C defines another class of variables called static variables. Static variables are of two types:Static variables tha..

    C programming interview questions

    What is a scope resolution operator in C ?

    The scope resolution operator (::) is useful in C programming when both global and local variables have the same name,..

    C programming interview questions

    What is register variable in C language ?

    C language allows the use of the prefix register in primitive variable declarations. Such variables are called register..