+ 2
When does post increment operation takes place .Does it increment immediately or directly in print statement ?
5 Antworten
+ 3
a = 1
print(a++) //Output = 1
print(a) //Output = 2
a = 1
print(++a) // Output = 2
print (a) //Output = 2
+ 3
In the final answer, in either pre incrementing or post incrementing, the final result is (x+1) if x is input. But, printf("x++"); gives x and printf("++x"); gives (x+1) as output .
+ 2
it doesn't take place immediately. ...it is postponed to the next expression and not the print statement.
suppose
int b=5;
int a=b++;
cout <<a;//out put=5
but if
c=++a;
cout <<c;//out put=7
0
by " not in print "statement I meant..... immediate print statement( in the above post I already sent)
0
thanks afreen for the explanation .