- 1

Guys please help me out with this?

int a=1; int b = a++; printf("%d", a); //Output: 2 Why is the output is 2? shouldn't be 1? Please anyone explain! Thanks in advance. here is the code→ https://code.sololearn.com/cdh7ExcOrs9G/?ref=app

22nd Sep 2018, 1:38 PM
XiON
XiON - avatar
2 ответов
+ 4
because you use here increment operator by this 1 is become 1+1 that's why the output is 2 that is too simple
22nd Sep 2018, 1:44 PM
Sphoorti Pipley
Sphoorti Pipley - avatar
+ 2
Look at this code and you will understand what you wrote. https://code.sololearn.com/cQjW1G7kpt8N/?ref=app
22nd Sep 2018, 3:20 PM
1010011011
1010011011 - avatar