++ (increment)

説明

変数の値を1だけ増加させます。

構文

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

x:変数。許容されるデータ型:int、long(場合によってはunsigned)。

戻り値

変数の元の値または新たに増加した値。

プログラム例

x = 2;
y = ++x;  // x now contains 3, y contains 3
y = x++;  // x contains 4, but y still contains 3
タイトルとURLをコピーしました