- 1

Int a=3,int b=2; b=a++; cout<<++b;

What is output and explain by another example?

10th Nov 2020, 5:33 PM
Yabsira Misrak
Yabsira Misrak - avatar
2 Answers
+ 2
Output is 4 for your question. . . int a=4; int b=5; b=++a; // a incremented by one and then assign to b .now b value is 5, a value is 5 a=b--; //b value is assign to a and then b value is decreased by 1.now a value is 5, b value is 4 cout<<a; cout<<b; output is 5 4
10th Nov 2020, 5:36 PM
NavyaSri
NavyaSri - avatar
+ 2
Learn this First b become 3 then 3 increament & become 4 , so output will be 4 https://www.sololearn.com/learn/CPlusPlus/1610/
10th Nov 2020, 5:39 PM
Sâùtôsh
Sâùtôsh - avatar