0
What is x=4,y=x++,then what is x and y.Tell me with an example pls..
give me proper guidance...
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
+ 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
+ 14
if x=4 y=++x
then x=5 and y=5
+ 13
@hdhd hdhd
c above explanation
@Mansi Dagla
Edit: and also
@Mohamad Abdelhafiz
directly above
+ 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).
+ 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
0
what if x=4,y=++x pls explain