+ 2
Pre increment int a=1; X=(++a)+(++a)+(++a); Answer is
17 RĂ©ponses
+ 13
These tricky increment games are nice but although they are syntactically correct they must never be used in a code due to undefined behaviors like Ace and Hatsy pointed out.
Creators of languages left these kind of syntax legal but a programmer must know it is to avoid.
+ 12
in java , it would be X will be 9 & a will be 4
//btw what u mean by answer ?
//X = 2 + 3 + 4
+ 8
As @Ace has pointed out, undefined behaviour.
https://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points
+ 1
a is not defined
+ 1
because A and a are different
+ 1
int a
+ 1
what is the programming language are you using?
+ 1
c++
+ 1
it should be 3 I think
+ 1
it should be 3 I think
+ 1
but in pc it displaying 4 i get confused
+ 1
so @Ace answer should be right
+ 1
ple explain how it works
0
compiler dependent.But for sake of answer apply right associativity