以不同方式表达变量赋值

时间:2014-11-03 18:53:17

标签: c variables variable-assignment

如何以不同的方式表达变量赋值(例如x = x * 3)?

1 个答案:

答案 0 :(得分:0)

这是另一种方式:

x *= 3;

同样,

x += 3; // it is the same as x = x + 3;
x -= 3; // it is the same as x = x - 3;
x /= 3; // it is the same as x = x/3;