+ 1
if x is a float and I have the usual increment x++, will x be increased by 1, or by something else?
for instance, x=3.14 x++ will be 4.14?
6 odpowiedzi
+ 2
Yes it will be increased by 1
+ 1
thanks ;)
0
but if you use loop you must use double
0
yes it increments one
0
first u see, prefix increment(++x), postfix increment.
x++ or ++x is increase by 1, eg, ++x=1+x;
x++=x+1;
if x=20;
then ++x=21,
or
also x++=21..... nothing any changes with ++x or x++
now, let y=++x, here, x=10;
so, we put x=10(initial value of x), y=11(value of y),x++=11(final value of x);
so, ans is y(x)=11;
and
let y=x++, here x=5:
we put x=5(initial value of x), y=5(value of y),x++=6(final value of x);
so, y(x)=5;
0
ur question is, x=3.14,
so x++=4.14?;
because x++ means x++=x+1;
x=3.14+1
x=4.14;
and if ++x=4.14?
here x=3.14,
so,++x=1+x;
++x=1+3.14
++x=4.14;
so, always remember ++x and ++x always x increase by 1;