Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Understanding lvalues and rvalues in C and C++

The terms lvalue and rvalue are not something one runs into often in C/C++ programming, but when one does, it’s usually not immediately clear what they mean. The most common place to run into these terms are in compiler error & warning messages. For example, compiling the following with gcc:int foo() {return 2;}int main(){ foo() = 2; return 0;}You get:test.c: In function 'main':test.c:8:5: error: lvalue required as left operand of assignmentTrue, this code is somewhat perverse and not something you’d write, but the error message mentions lvalue, which is not a term one ...

3,406 0       C++ ELABORATION LVALUE RVALUE LOCATOR VALUE