++ 1 + + +我+ ++我在Java中对C [英] ++i + ++i + ++i in Java vs C

查看:224
本文介绍了++ 1 + + +我+ ++我在Java中对C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/1525187/how-do-we-explain-the-result-of-the-ex$p$pssion-xxx\">How我们解释前pression的结果(++ x)+(++ X)+(++ x)的?


  INT I = 2;
I = + 1 + + + 1 + + +我;

哪个更正确的? 12或C = 13,或者,如果没有正确的事情Java的结果,请详细说明。谢谢你。


解决方案

有没有像更正确。它实际上是不确定的,其所谓的序列点错误。
<一href=\"http://en.wikipedia.org/wiki/Sequence_point\">http://en.wikipedia.org/wiki/Sequence_point

Possible Duplicate:
How do we explain the result of the expression (++x)+(++x)+(++x)?

int i=2;
i = ++i + ++i + ++i;

Which is more correct? Java's result of 12 or C = 13. Or if not a matter of correctness, please elaborate. Thank you.

解决方案

There is nothing like more correct. It is actually undefined and its called Sequence Point Error. http://en.wikipedia.org/wiki/Sequence_point

这篇关于++ 1 + + +我+ ++我在Java中对C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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