且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

汽车"&的概念QUOT;关键字在C

更新时间:2022-10-15 11:24:56

汽车不是数据类型。这是一个存储类说明,如静态的。对局部变量使用,表示变量的生命周期等于它的范围时,它基本上是静态的相反(即:当它超出范围会自动销毁)。

您不需要指定汽车为你被允许使用它,它也是默认的。唯一的地方

Could you please give me the exact concept of the keyword "auto" in a C program.

When i gone through one book "Deep C secrets" , got the below quote.

The auto keyword is apparently useless. It is only meaningful to a compiler-writer making an entry in a symbol table—it 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.

auto isn't a datatype. It's a storage class specifier, like static. It's basically the opposite of static when used on local variables and indicates that the variable's lifetime is equal to its scope (ie: when it goes out of scope it is automatically destroyed).

You never need to specify auto as the only places you're allowed to use it it is also the default.