x--或x ++在这做什么? [英] what does x-- or x++ do here?
本文介绍了x--或x ++在这做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于大多数人来说这是一个愚蠢的问题 - 我知道 - 但我是这里的初学者之一,我无法理解为什么这里的输出是12这是什么( x -
)对结果做了什么?
it is a silly Q for most of u - i know - but i one of the beginner here, and I can not understand why the output in here are 12 what does this (x--
) do to the result ?
int x, y;
x = 7;
x-- ;
y = x * 2;
x = 3;
推荐答案
只是警示,有时是前后增量运营商可能会有意想不到的结果
Just a cautionary note, sometimes the pre and post increment operators can have unexpected results
以及:
x[i]=i++ + 1;
do
在这里阅读:
http://www.angelikalanger.com/Articles/VSJ/SequencePoints/ SequencePoints.html
这篇关于x--或x ++在这做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文