Please explain to me the difference between ++x and x++ ? If you could give and example that includes evaluating a y variable to | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Please explain to me the difference between ++x and x++ ? If you could give and example that includes evaluating a y variable to

Incremental x++

12th Nov 2016, 12:25 AM
Alice
Alice - avatar
2 ответов
+ 2
x=5 y=++x (x=6,y=6) x=5 y=x++ (x=6,y=5)
12th Nov 2016, 12:35 AM
John Kovanis
John Kovanis - avatar
+ 2
On resume if you have int i=0; int j = ++i; // j=1 and i=1 but if use int i=0; int j = i++; // j=1 and i=0
12th Nov 2016, 1:20 AM
Eduardo
Eduardo - avatar