++

名称

++

説明

変数を増分(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任意の変数。利用可能な型: int, long(unsignedも)。

戻り値

基の値(後置の場合)、もしくは、増分後の値(前置の場合)

使用例

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

参照

オリジナルのページ

https://www.arduino.cc/reference/en/language/structure/compound-operators/increment/

Last Revision: 2020/10/04

最終更新日

January 4, 2024

inserted by FC2 system