Oh yes. You are right. I just overlooked the code and indeed mistyped. Sorry for that.
it was actually,
1 2 3
a=-3 - -3;
b=-3 - -(-3);
I have two more questions in my mind,
1. Does that statement, a=i++;
expand to these two statements
1 2
a=i;
i=i+1; //So that first value of i is assigned to a, and then i is incremented
Is this right to write this expanded code for understanding complex problems ?
2. Does increment/decrement operator work on constants too as in 56++ , --9.56.
While doing that, compiler is generating error: LValue required.
Is this because compilers are made to generate such hard coded error or any syntax has gone wrong ?
1) Correct. As for whether or not it is moral...it would depend on the situation really. Generally, I would say it is not, but I'm sure there are some situations where it would be acceptable.
2) No, because constants are considered RValues, and those operators (since they modify the argument) need LValues.