+ 7

Confusion to understand!!

pre increment and post increment 😣😣 pre decrement and post decrement😵😲

12th May 2018, 6:41 PM
Rishabh Singh
Rishabh Singh - avatar
5 ответов
+ 7
x = 1 if you do y = ++x ( x is 2 and y is 2 ) if you do y = x++ ( x is 2 and y is 1 ) it works the same with decrement ++x first increment it then assign it to y x++ first assign it to y then increment it
12th May 2018, 6:48 PM
Kawaii
Kawaii - avatar
+ 4
indeed but its easy to learn pre increment x=10 y=++x //x=11 y=11 it will first increase and then y becomes x with one element it will increase x=10 x=++x //x=11 same with pre decrement post increment x=10 y=x++ //x=11 y=10 first y will become same as x, and after that x will increase with one element x will stay the same x=10 x=x++ //x=10 to increase use only x=10 x++ //x=11 same with post decrement
12th May 2018, 6:52 PM
Roel
Roel - avatar
+ 4
The increment operator has two forms, prefix and postfix. Prefix ++x increments the value, and then proceeds with the expression. Postfix x++ evaluates the expression and then performs the incrementing The decrement operator (--) works in much the same way as the increment operator, but instead of increasing the value, it decreases it by one.
12th May 2018, 6:55 PM
Michael Ngwerume
Michael Ngwerume - avatar
+ 1
https://www.sololearn.com/Discuss/407846/?ref=hiapp
12th May 2018, 6:55 PM
MsJ
MsJ - avatar