+ 2
Help... if x++ is equivalent to x=x+1.
what is ++x equivalent to???.
5 Antworten
+ 5
++x: load x from memory, increment, use, store back to memory.
x++: load x from memory, use, increment, store back to memory.
so they do the same thing just in different order
+ 2
yes x++ is equivalent to x=x+1
++x=x+1 but difference is that in 1st case first valuu of x asign then increse for example int x=3; y=x++ here first value of x initilise thn increse
in 2nd case first increase the value of x thn assign
hope u can understand this thing thanku
+ 2
VERY SIMPLY PUT:
IN ++x ,
the equation is first solved before adding the value
I.e
x = 5
y=++x
solution
y is first equal to x (y=5) ,
then the increment ( which means adding 1)
is then added to x (x= 6 but y=5)
get it now bro?
+ 1
good question ?
0
2