自动变量就是局部变量,他们的内存是自动分配的,自动释放的。
The variables which are declared inside a block are known as automatic or local variables; these variables allocates memory automatically upon entry to that block and free the occupied memory upon exit from that block.
These variables have local scope to that block only that means these can be accessed in which variable declared.
Keyword 'auto' may be used to declare automatic variable but we can declare these variable without using 'auto' keywords.
Consider the following declarations
int main() { auto int a; int b; .... return 0; }
Here, both variables a and b are automatic variables.
参考:
https://www.includehelp.com/c/automatic-auto-variables-in-c-language.aspx