I get very confused at times with the shorthand increment operation.
Since when i was little programming in BASIC, i got some how stuck with a = a+1 which is long painful way of saying 'Get a's current value, add 1 to it and then store the new value back to a'.
1] a = a +1 ;
2] a++ ;
3] ++a;
4] a +=1;
[1] and [4] are similar in functionality different in notation, right?
2] and 3] work simply differently because of the fact that the increment signs ++ is before and after. Right?
Am I safe to assume the below?
int f(int x){ return x * x;}
y = f(x++) -> for x =2, f(x) = x^2
f(x) ======> y= 2^2 =4
x=x+1; ======> x= 2+1 = 3
y = f(++x) -> for x =2, f(x) = x^2
x=x+1 ===========> x = 2+1 = 3
f(x) ===========> y =3^2 = 9