<<< Special operators | Index | Assignment operators >>> |
lvalue is an object that refers to a region of storage in memory that can be both examined and stored into.
However, lvalue does not necessarily permit modification of the object it designates.
Thus, lvalue can be
modifiable lvalue
non-modifiable lvalue
For example, a function call that returns a reference is an lvalue.
Certain operators require lvalues:
&X // Unary address-of operator requires that operand X must be an lvalue. X++ --X // Operand X must be an lvalue. This applies to both prefix and postfix forms. = += -= *= %= <<= >>= &= ^= |= // Left operand must be an lvalue.
The term rvalue refers to a data value that is stored at some address in memory.
An rvalue cannot have a new value assigned to it, for example,
literal constant "Hello" or a const variable.
When necessary, an lvalue is implicitly converted to an rvalue, but the reverse, however, is not true: an rvalue cannot be converted to an lvalue.
<<< Special operators | Index | Assignment operators >>> |