| Lvalues and Rvalues

Previous | Operators and Punctuators |

All expressions in C language may be classified to lvalues and rvalues.
An lvalue is an object locator: an expression that designates an object. Any variable is an lvalue for example. Another example of an lvalue expression is `'*P'`, where `P` is any expression evaluating to a non-null pointer. See dereference operator for more information.
A modifiable lvalue is an identifier or expression that relates to an object that can be accessed and legally changed in memory. A const pointer to a constant, for example, is not a modifiable lvalue. A pointer to a constant can be changed (but its dereferenced value cannot).
Historically, the "l" stood for "left", meaning that an lvalue could legally stand on the left (the receiving end) of an assignment statement. Now, only modifiable lvalues can legally stand on the left of an assignment statement. For example, if `'a'` and `'b'` are nonconstant integer identifiers with properly allocated memory storage, they are both modifiable lvalues, and assignments such as

    a = 1;
    b = a + b;

are legal. From the other side, the expression

    a + b

is not an lvalue: `'a + b = a'` is illegal because the expression on the left is not related to an object. Such expressions are often called rvalues (short for "right values").
Note: In GNU C, the class of lvalue expressions is wider than in other C dialects; see section Generalized Lvalues for more info.