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/ In function ‘int main()’:
/tmp/ non-lvalue in assignment
/tmp/ non-lvalue in assignment
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates