Help... if x++ is equivalent to x=x+1. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Help... if x++ is equivalent to x=x+1.

what is ++x equivalent to???.

14th Dec 2016, 7:49 PM
stephen haokip
stephen haokip - avatar
5 ответов
+ 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
14th Dec 2016, 7:56 PM
Leonida17st
Leonida17st - avatar
+ 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
14th Dec 2016, 7:55 PM
Rajesh Sahu
Rajesh Sahu - avatar
+ 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?
24th Dec 2016, 5:16 PM
Okafor Bryce
Okafor Bryce - avatar
+ 1
good question ?
14th Dec 2016, 11:22 PM
Rejon
Rejon - avatar
0
2
28th Dec 2022, 11:34 AM
Kibru 12