0
Increment
Int x=1,y; so here what is the main difference between y=x++ and y=x+1 why one makes y=1 and second y=2
2 Réponses
+ 1
Muhammad Zubair x++ is post increment...
once you do y=x++;, two operations are done... first it assign value of x to y...so, y is 1 as of now... next, x is incremented as x=x+1 ...so, x becomes 2 and y remain 1...
while in second case, simply we are adding value of x and 1 to y...so, y becomes 2
+ 1
thanks Ketan Lalcheta