+ 1

Whats is the reason of ++b no apply the sum ?

int a = 3; int b =40; b=a++; consolewrite(++b); answer is 4 but in the console are ++ most be 5 im confused.

14th Jun 2017, 3:57 AM
Zamir José Suazo Gómez
Zamir José Suazo Gómez - avatar
1 Réponse
+ 14
b=a++ means first assignment of a on b is done and then increment of a so b becomes 3 and a becomes 4 afterwards And in output ++b so.. increment first and then output So the answer is 4
14th Jun 2017, 4:00 AM
Frost
Frost - avatar