Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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

+27 votes
asked Jun 18, 2019 by kj
closed Dec 27, 2021 by Admin
closed with the note: answered

38 Answers

–1 vote
answered Jul 4, 2019 by anonymous
Answer is 6.
–1 vote
answered Jul 5, 2019 by anonymous
answer would be 6
–1 vote
answered Jul 6, 2019 by anonymous
a=2
++a=2+1=3
a++=3
++a+a++=3+3=6
–1 vote
answered Jan 17, 2020 by Warisha Laique (300 points)
++a=3

a++=2

++a + a++ =3+2 =5

output:5
–1 vote
answered Jan 20, 2020 by VINIT SAMMIR (240 points)
6, beacuse first increase and after then add icrease value
3+3=6
–1 vote
answered Jan 23, 2020 by Ramesh Yedage (130 points)
int a=2;

a++=2+1=3

++a=3
–1 vote
answered Jan 27, 2020 by Parth Ahluwalia
this is a problem of post and pre increment so the answer is 6
–1 vote
answered Jan 31, 2020 by teja sree (360 points)
answer is:6 first it  is preincrement so the value is incremented and assigned to a. Next as it is post increment it assigns the value and the value of a will be incremented.
0 votes
answered Feb 2, 2020 by VINIT SAMMIR (240 points)
the ans is seven beacuse first it check right and thencheck left
–1 vote
answered Feb 3, 2020 by Aparna Tripathi (160 points)
++a=3,a++=2

i.e 5
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.
...