汽车"&的概念QUOT;关键字在C [英] Concept of "auto" keyword in c
问题描述
您能给我关键字汽车的确切概念的C程序。
当我通过一本书了深度C机密,得到了以下的报价。
auto关键字显然是
无用。它是唯一有意义的一
编译器的作家做了一个条目
符号表,它说,这是存储
在进入自动分配
嵌段(相对于全局静态
分配或动态分配的
堆)。汽车无关
其他程序员,因为你用得到它
默认值。
块引用>解决方案
汽车
不是数据类型。这是一个存储类说明,如静态的。对局部变量使用,表示变量的生命周期等于它的范围时,它基本上是静态的相反(即:当它超出范围会自动销毁)。您不需要指定
汽车
为你被允许使用它,它也是默认的。唯一的地方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.这篇关于汽车"&的概念QUOT;关键字在C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!