+ 4
What is the difference between a ++5 and a 5++
7 Answers
+ 9
5 is an integer literal and cannot be incremented. Both ++5 and 5++ are wrong. Increment can only be performed on variables (x++, ++i etc.)
+ 6
You can think that ++x and x++ performs 2 tasks: increments x by 1 and returns x's value.
The difference between ++x and x++ is on: which of these 2 tasks is performed first.
In ++x: x first get's incremented by 1, then it returns x's value.
In x++: first x's value get's returned, then x is incremented by 1.
+ 6
https://code.sololearn.com/cCCCG1UQ2fss/?ref=app
This will Clear your doubts :).
+ 2
Isloe Zuber see Seb TheS above answer
+ 1
so what is the difference between ++x or x++?
+ 1
1.Priority of x++ is less than all of operator c have .
2. Priority of ++x is greater than all of operator c have.
3. But... they work in same way.