C: Error while using: "Combined assignment" and "Prefix abbreviation" together
Can someone tell me why the compiler C
throws an error when using Compound Assignment
and at the same time Prefix Dec/Inc
? [but C++
doesn't work]
int myVar = 5;
(--myVar) -= 4;
// C : error C2106: '-=' : left operand must be l-value
// C++: myVar=0;
I know what the error says ...
But I can't figure out why the compiler C
can't recognize myVar
as an l-value , but C++
does ?!
+3
source to share