出来发表声明 [英] Out put for a statement

查看:76
本文介绍了出来发表声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int a=29;
a--;
//what is the out put of 'a' here and how?
a-=++a;
//what is the out put of 'a' here and how?





请解释任何一个,


感谢提前



Please explain any one ,

Thanks for advance

推荐答案

,首先你的输出将是28



因为你的a会在行执行完成后减少



而在第二种情况下你的输出将是



-1

因为按照优先顺序(从右到左)

将进行第一次增量操作然后

将进行减法操作。

a = a - ++ a
in first can your output will be 28

because your a will get decremented after line execution completes

and in second case your output will be

-1
because as per precedence (right to left)
first increment operation will be carried out and then
substraction operation will be carried out.
a= a - ++a


这篇关于出来发表声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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