Tag: increment

++ i C#和C ++中的运算符差异

我有以下用C ++和C#编写的代码 int i=0; ++i = 11; 在此C#编译器带来错误之后 The left-hand side of an assignment must be a variable, property or indexer 但C ++编译器生成此代码时没有错误,我得到了一个值为i的结果11 。 这种差异的原因是什么?