hi everyone well i m little bit confused about the use of pre an post increment infact my thinking contradict with the logic of programe
lets consider an example
x=5;
y=x++;
z=x;
after the execution of these statments value of y will b 5 while value of z will be 6
WHY?
value of x++ and x=x+1is equal it first assign a value of x to y then increment in x. why?
expression on the right must be executed first then it must assign value to y
mean to saty value of y must be 6 just like pre increment.
if not then what about the given expression
y=x*3+2;
in this case why it is not assigning a value of x to y first and then solving expression?
although it first solve expression and then assign its value to y.
i m too much confuse about this please help me out