Explain this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Explain this?

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int x = 3; int y = ++x; Console.WriteLine(x+" "+y); } } }

6th Nov 2019, 2:23 PM
Minhaj Haider
Minhaj Haider - avatar
1 Answer
0
x = 3 ++x is 4, the value(3) of x is add 1 and then move the value(4) to y, so the value of y is 4 x++ is 3, It move the value(3) to y first, then it add 1(become 4)
7th Nov 2019, 11:10 AM
GUI
GUI - avatar