+ 4
Why x is not incremented in the following
int x=1; x++; cout<<x;
5 odpowiedzi
+ 5
x++ - Uses x's value before incrementing it
++x - Increments x before using it.
int x = 10;
cout << x++; //10
x++; // +1
cout << x; //10 + 1 = 11
+ 4
Incremented
+ 3
It is incremented?
+ 2
because when it shows output the value of x for first time it shows the old value of x
but
when it execute second time it shows the increamented value of x
but why does this happen??
+ 2
but how it is not incremented when I run the program