When do we get \"l-value required\" error...while compiling C++ program???(i am using VC++ )
R Value is an expression that always appear on right side of an assignment operator Eg:
int a = 5;//here 5 is Rvalue
L Value is an expression that can either come on left or right side of an assignment.When it is in on left side it refers to a place that can hold a value.
Here
a
in expressiona = 5
is L Value
and when appearing on right side value is read from the L Value. Since R value which does not have capability to locate any memory it cannot hold any value like LValue so
5 = 6 or 5 = a
will be compiler error.