0

Is y=x and y=x++ the same ?

4th Feb 2017, 7:40 PM
Young
3 Respostas
+ 2
If you look at how y changes, yes! if you look at how x changes, no!
4th Feb 2017, 7:53 PM
seamiki
seamiki - avatar
+ 1
speaking about c++ , no its not . y=x means the y takes the value of x . y=x++ ; means y takes the value of x and then add 1 to it. ( sorry poor english language , hope you understood)
4th Feb 2017, 7:44 PM
Norelhouda Gribi (Hinette Gribi)
Norelhouda Gribi (Hinette Gribi) - avatar
+ 1
For y it would be, but for x it wouldn't. Say you have x = 10; if you write y = x, then x would still be 10, but with y = x++, x would be 11 afterwards. y would be 10 in both cases though.
4th Feb 2017, 7:45 PM
Nico Loos
Nico Loos - avatar