int a=2; printf("%d", ++a + a++);

+10 votes
asked Jun 18, 2019 by kj

36 Answers

0 votes
answered Feb 3 by (140 points)

answer is 6, as it follow right to left precedence.

    4   +    2  =  6

(++a + a++)

   4        3

0 votes
answered Feb 3 by anonymous
5 wil be the answer because ++a indiactes pre increment operator which increments value before execution.

a++ is post increment operator which will increment the value after execution.
0 votes
answered Feb 3 by Deep
7

because:initially a=2; ++a=3 then next a++ =4. Thus, ++a + a++ = 3+4=7
0 votes
answered Feb 5 by (560 points)
7 because for the ++a the value becomes 3 and again a++ the value becomes 4

so,finally 3+4=7
0 votes
answered Feb 5 by Rajeshkumar
a=2

++a=3

a++=2

++a + a++ = 5
0 votes
answered 3 days ago by anonymous
6 is the right answer
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...