in Programming in C
490 views
0 votes
0 votes
why did the statement c++=b%(b-a) will gives error
in Programming in C
by
490 views

3 Comments

It will give you the lvalue required error because When you have an assignment operator in a statement, the LHS of the operator must be something the language calls an lvalue.

For more info-https://stackoverflow.com/questions/33375136/lvalue-required-as-left-operand-of-assignment-error-when-using-c

0
0
will it not give undefined behaviour?
0
0
I think it will not give undefined behaviour because after changing the statement with c+=b%(b-a), it will run perfectly.
0
0

1 Answer

0 votes
0 votes

It will give an lvalue required error because assignment operator requires its LHS should be in memory operand.
Means LHS should be an assignable variable to which you can assign value.
Here you are assigning the value to an expression that's why it is giving error. 

Related questions