++

[Compound Operators]

説明

変数の値を 1 増加します。

構文

x++; // increment x by one and returns the old value of x
++x; // increment x by one and returns the new value of x

媒介変数

x: 変数。許可されるデータ型: intlong (possibly unsigned).

戻り値

変数の元の値または新しく増分された値。

x = 2;
y = ++x;  // x now contains 3, y contains 3
y = x++;  // x contains 4, but y still contains 3

Language Reference Home

86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

上部へスクロール