In many situation we have to make a difference between expressions defining a value that can be addressed (and changed), which are called lvalue and value that can be only read, called rvalue. For example, the assignment operator expect a lvalue on the left and a rvalue on the right.

So far the only lvalue we have seen are variables.

#include <iostream>
int main(int argc, char **argv) {
int i;
i+3 = 5; // does not compile
45 = i; // does not compile
}

leads to the following compilation errors :

/tmp/something.cc: In function ‘int main()’:
/tmp/something.cc:4: non-lvalue in assignment
/tmp/something.cc:5: non-lvalue in assignment
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates