0

Explain this?

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

6th Nov 2019, 2:25 PM
Minhaj Haider
Minhaj Haider - avatar
1 Respuesta
0
When you put `++` at the end, `=` operand will be executed first. Like this➡️ y = x; x += 1; And if you put `++` at the front of `x`, `++` will be executed first , then the `=` operand. Like this➡️ x += 1; y = x; And your output will be `4 4`.
6th Nov 2019, 4:35 PM
o.gak
o.gak - avatar