你能否在C程序中给出关键字“auto”的确切概念.
当我通过一本书“深C秘密”,得到以下报价.
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不是数据类型.它是一个存储类说明符,如静态.它基本上与静态相反,当在局部变量上使用时,表明变量的生命周期等于其范围(即,当它超出范围时,它被自动破坏).
您不需要将auto指定为唯一允许使用它的地方,它也是默认值.