0

What is x=4,y=x++,then what is x and y.Tell me with an example pls..

give me proper guidance...

12th Mar 2017, 6:32 PM
hdhd hdhd
7 odpowiedzi
+ 17
x=4 y=x++ means post increment which use value first then perform increment so, y= 4 now value is used so the increment process will occur so, x=5 i.e., x=5 and y=4
12th Mar 2017, 6:38 PM
Mansi Dagla
Mansi Dagla - avatar
+ 15
x=4 y=++x means first increment the value then use it x will incremented first so, x=5 now the value is assigned to y so, y=5 i.e.,x=5 and y=5
12th Mar 2017, 6:56 PM
Mansi Dagla
Mansi Dagla - avatar
+ 14
if x=4 y=++x then x=5 and y=5
12th Mar 2017, 6:52 PM
Prudhvi Raaj
Prudhvi Raaj - avatar
+ 13
@hdhd hdhd c above explanation @Mansi Dagla Edit: and also @Mohamad Abdelhafiz directly above
13th Jun 2017, 6:41 AM
niteOwLTwO
niteOwLTwO - avatar
+ 11
x++ increments x by 1, but it happens very late in order of operations. In fact, x is assigned to y before it increments to 5! So in this case, x = 5 (because it was incremented), and y = 4 (the old value of x before the incrementer worked).
12th Mar 2017, 6:37 PM
Tamra
Tamra - avatar
+ 2
++x means increment then enter the new value. x = 4; y = ++x; So, x will increment then x = 5. and y = x So, y = 5
12th Mar 2017, 6:51 PM
Mohamad Abdelhafiz
Mohamad Abdelhafiz - avatar
0
what if x=4,y=++x pls explain
12th Mar 2017, 6:46 PM
hdhd hdhd