0
How can I see the value of y after it is incremented on y = x++
On the example below if I run 'cout << y' it will show me the value 5 however the expression y=x++ indicates that it will assign y the value x then increment y. My question is how do I see the value of y after it is incremented? or is y not incremented when we say y=x++? Thanks a bunch! x = 5; y = x++; // x is 6, y is 5
4 Answers
+ 2
Here y will be assigned value of x and than x will be incremented not y because you have use postfix increment in x not y.
Hope this helps âșïžâșïž.
0
x become 6 after y = x and that is why y = 5
In other words first y = x than x++
0
do y = ++x
0
Helina Abye Gebreyes similar question has been asked so many times previously...please use search before posting question to avoid repetition of duplicate questions:
you may like to refer previous thread :
https://www.sololearn.com/Discuss/489143/?ref=app