汽车"&的概念QUOT;关键字在C [英] Concept of "auto" keyword in c

查看:129
本文介绍了汽车"&的概念QUOT;关键字在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆