+ 4

Why x is not incremented in the following

int x=1; x++; cout<<x;

17th May 2017, 5:38 AM
KABILESH KANNAN
KABILESH KANNAN - avatar
6 Respuestas
+ 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
17th May 2017, 6:55 AM
Complex
Complex - avatar
+ 4
Incremented
17th May 2017, 6:02 AM
Calviղ
Calviղ - avatar
+ 3
It is incremented?
17th May 2017, 5:42 AM
Maart
Maart - avatar
+ 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??
17th May 2017, 5:42 AM
KABILESH KANNAN
KABILESH KANNAN - avatar
+ 2
but how it is not incremented when I run the program
17th May 2017, 5:44 AM
KABILESH KANNAN
KABILESH KANNAN - avatar