The expected outcome dosent agree with result. Following is the code snippet.
int a,c;
a=10; c=0;
c=(--a)+(--a);
printf("C: %d", c);
printf("\nValue of a: %d", a);
I expected C to be 17 i.e (9+8), but it comes out to be 16. And a becomes 8 as expected.
When expression is changed to like this.
c=(--a);
c=c+(--a);
Then it works fine.
Someone please point out where is loophole in my knowledge.
Thanx.