I have tried the postfix in my Xamarin studio and the code is like int x = 2; int y = x++; then WHAT would be the output?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I have tried the postfix in my Xamarin studio and the code is like int x = 2; int y = x++; then WHAT would be the output??

When I try to run the program the results of both is 2. I can't understand it please help

20th May 2017, 7:50 AM
Emranul haque
Emranul haque - avatar
2 Answers
0
Yeah,I think so,but your given code is not complete,I think
20th May 2017, 11:26 AM
Jacky
0
y=2..this is because x++ means post-increment where u first use the current value of x (then if it is in a loop,in the next loop the value of x=3...)
21st May 2017, 12:40 PM
Stanz Martins
Stanz Martins - avatar