为什么用C而不是+++++ b工作? [英] Why doesn't a+++++b work in C?
本文介绍了为什么用C而不是+++++ b工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int main ()
{
int a = 5,b = 2;
printf("%d",a+++++b);
return 0;
}
这code提供了以下错误:
This code gives the following error:
错误:左值要求作为增量的操作数
error: lvalue required as increment operand
但是,如果我把空格整个 A ++ +
和 ++ b
,然后正常工作。
But if I put spaces throughout a++ +
and ++b
, then it works fine.
int main ()
{
int a = 5,b = 2;
printf("%d",a++ + ++b);
return 0;
}
什么是错误的第一个例子是什么意思?
What does the error mean in the first example?
推荐答案
的printf(%d个,一个+++++ B);
是间preTED为(A ++)++ + b
根据最大蒙克规则!。
printf("%d",a+++++b);
is interpreted as (a++)++ + b
according to the Maximal Munch Rule!.
++
(后缀)不计算到左值
,但它需要它的操作数是左值
。
++
(postfix) doesn't evaluate to an lvalue
but it requires its operand to be an lvalue
.
<子>!
6.4 / 4说
接下来的preprocessing令牌的最长序列可能构成preprocessing令牌
这篇关于为什么用C而不是+++++ b工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文