0
What is the output of this code? int a = 4; int b = 6; b = a++; Console.WriteLine(++b);
11 Answers
+ 6
int a = 4;
int b = 6;
b = a++; //b=4 and a=5
Console.WriteLine(++b); //b=5
+ 6
nt a = 4;
int b = 6;
b = a++; //b=4 and a=5
Console.WriteLine(++b); //b=5
Answer 5
+ 5
5
+ 4
5
+ 2
b=5
+ 2
5
+ 2
Okay but why is the result 4 for b and stops at 5
+ 1
5
+ 1
b is overwrited by (!not incremented) a, and incremented only once in output line. So a and b is 5.
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!
0
5