let
x=5
y=++x + ++x;
find x,y;
according to me this output should be come 7,13
but compile give output of x,y ->7,14 why?
Pre increment operator
Hi khem chand
unary operators (pre/post increment) has higher precedence than binary(addition) operators. First all the pre increment operators will be calculated and then the addition takes place.
y = (++x) + (++x)
1. 2.
calculating 1 and 2 gives x=7
y=7+7=14
Hope it helps