In C programming language an auto keyword defines a local variable storage class that has a local or limited lifetime from the end of its declaration to the end of its enclosing scope (block or function); once program flow exit that scope, that instance of the variable ceases to exist.
Syntax ‘auto’ keyword in the C Programming language:
Auto [data_type] [variable_name];
auto int number; or
Both the statement has the same meaning. As auto keyword is the local lifetime is the default for local variables, auto keyword is extremely rarely used it’s only meaningful to a compiler-writer or interpreter developer making an entry in a symbol table or better readability auto keyword can be used. Auto keyword says this storage is automatically allocated on entering the block (as opposed to global static allocation, or dynamic allocation on the heap). Auto is irrelevant to other programmers, since you get it by default.
C Program of ‘auto’ keyword:
auto int i=10;
auto int i=20;
printf(“\n\t %d”, i);
Output: 20 10
Note: GNU C extends auto keyword to allow forward declaration of nested functions.