为什么A +++++ b不起作用? [英] Why doesn't a+++++b work?
本文介绍了为什么A +++++ b不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int main ()
{
int a = 5,b = 2;
printf("%d",a+++++b);
return 0;
}
此代码给出以下错误:
错误:需要左值作为增量操作数
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",a +++++ b);
被解释为(a ++)++ + b
根据最大蒙克法则!.
printf("%d",a+++++b);
is interpreted as (a++)++ + b
according to the Maximal Munch Rule!.
++
(后缀)的值不等于 lvalue
,但它的操作数必须是 lvalue
.
++
(postfix) doesn't evaluate to an lvalue
but it requires its operand to be an lvalue
.
!6.4/4说下一个预处理令牌是可以构成预处理令牌的最长字符序列"
这篇关于为什么A +++++ b不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文