0

What is the output of this code? int a = 4; int b = 6; b = a++; Console.WriteLine(++b);

24th Sep 2016, 9:10 AM
Elvin Namazov
11 odpowiedzi
+ 6
int a = 4; int b = 6; b = a++; //b=4 and a=5 Console.WriteLine(++b); //b=5
24th Sep 2016, 9:19 AM
மனோஜ்குமார் பழனிச்சாமி
மனோஜ்குமார் பழனிச்சாமி - avatar
+ 6
nt a = 4; int b = 6; b = a++; //b=4 and a=5 Console.WriteLine(++b); //b=5 Answer 5
28th Mar 2019, 5:00 AM
Sridhar Raj.P
Sridhar Raj.P - avatar
+ 5
5
27th Sep 2016, 5:22 AM
Vishwanath Patil
Vishwanath Patil - avatar
+ 4
5
24th Sep 2016, 11:55 AM
Barvadiya Jagdish
Barvadiya Jagdish - avatar
+ 2
b=5
24th Sep 2016, 9:28 AM
Pratibha
+ 2
5
24th Sep 2016, 5:41 PM
Zachary Blubaugh
Zachary Blubaugh - avatar
+ 2
Okay but why is the result 4 for b and stops at 5
30th Jan 2018, 5:29 AM
A
A - avatar
+ 1
5
24th Sep 2016, 11:01 PM
Вадим Мещеряков
Вадим Мещеряков - avatar
+ 1
b is overwrited by (!not incremented) a, and incremented only once in output line. So a and b is 5.
17th Nov 2018, 6:14 PM
MetaJamm
MetaJamm - avatar
0
I have the same question, We want to learn here but how i can learn when I don't know why the result 5 is? It is not eneugh to have this questions in SoloLearn we need an Explanation why the Result is 5 and not something else!
10th Jun 2018, 11:19 PM
Zela Media
Zela Media - avatar
0
5
22nd Sep 2022, 4:33 AM
Cherrymae Sumuhid
Cherrymae Sumuhid - avatar