What is the different between x++ and ++x? Have tried both, nothing changed. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the different between x++ and ++x? Have tried both, nothing changed.

25th Jul 2016, 12:05 AM
Wall Ace
Wall Ace - avatar
2 Answers
+ 1
if u use ++a and it will print the incremented value eg: if a=5 then it will print 6 when u use a++ it will get incremented only in next step eg: if a=5 it will print 5
27th Jul 2016, 9:51 AM
Dhilipan Manoharan
Dhilipan Manoharan - avatar
0
examples: a=x++ means a=x and x=x+1different to a=++x that means x=a=x+1
26th Jul 2016, 1:29 PM
Vassidiki DOUMOUYA
Vassidiki DOUMOUYA - avatar