恒实施例pression"的东西是,并且是没有,&QUOT例子;用C? [英] Example of something which is, and is not, a "Constant Expression" in C?

查看:119
本文介绍了恒实施例pression"的东西是,并且是没有,&QUOT例子;用C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的是什么,是不是在C恒定防爆pression糊涂一点点,即使经过多次Googleing。你能提供的东西是一个例子,这是不是在C恒定防爆pression?

I'm a tad confused between what is and is not a Constant Expression in C, even after much Googleing. Could you provide an example of something which is, and which is not, a Constant Expression in C?

推荐答案

一个恒定的前pression可以在编译时进行评估。这意味着它有任何变量在它。例如:

A constant expression can be evaluated at compile time. That means it has no variables in it. For example:

5 + 7 / 3

是一个不断前pression。是这样的:

is a constant expression. Something like:

5 + someNumber / 3

不是,假设 someNumber 是一个变量(即本身不是一个编译时间常数)。

is not, assuming someNumber is a variable (ie, not itself a compile-time constant).

这篇关于恒实施例pression"的东西是,并且是没有,&QUOT例子;用C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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