+ 1

How does this work?

how does 22 get printed? shouldn't it be 6+7+8 = 21 ? int a =5; int j = ++a + ++a + ++a; printf("%d",j);

3rd Apr 2021, 9:28 AM
Shane Umayanga
Shane Umayanga - avatar
4 Réponses
+ 2
Shane Umayanga In Java/PHP it is giving 21
3rd Apr 2021, 9:49 AM
A͢J
A͢J - avatar
+ 2
undefined behavior..u cant expect same result from different compiler
3rd Apr 2021, 10:14 AM
durian
durian - avatar
3rd Apr 2021, 9:50 AM
Shane Umayanga
Shane Umayanga - avatar