Why is the Output of this code gives the value 100. Please help me to understand this behavior.
static void Main(string[] args)
{
int i = 100;
for (int n = 0; n < 100; n++)
{
i = i++;
}
Console.WriteLine(i); // This gives the Value 100 why?
}
I have ran the same code in both C and C# compiler. in C compiler gives the value 200 in C# compiler gives the value 100.
why the same piece of code is behaving like this in two Compilers?