Following is line of code in c.
i++=i++;
Output:Error Lvalue required.
So what does this error indicate?
Following is line of code in c.
i++=i++;
Output:Error Lvalue required.
So what does this error indicate?
The result of i++
is not a lvalue and the standard requires the left operand of the assignment operator to be a lvalue.
Even if it was allowed your program would invoke undefined behavior as you are trying to modify the same object twice between two sequence points.
It indicates that i++
is not assignable. It is like trying to assign to 1
(which i++
will yield when i
stored the value 1
).
Of course that makes no sense. You can compare it to trying to change the color "red", when you actually wanted to first paint your paper red and then blue.
It's saying left value required. You are doing an assignment left = right. i++ can't be a left because it's a right. Remove the terseness and your line of code sort of becomes
i + 1 = i + 1, which is an equation not an assignment.
On top of that what are you actually trying to do?