I have this code :
static void Main(string[] args)
{
int a = 1;
int b = 1;
int c;
//task A
c = a;
Console.WriteLine(c);
c = a++;
Console.WriteLine(c);
Console.WriteLine(c);
//task B
c = b;
Console.WriteLine(c);
c = b++;
Console.WriteLine(c);
c = b;
Console.WriteLine(c);
Console.ReadLine();
}
the output is:
task A
1 1 1
task B
1 1 2
Task A question
I expected the result from task A are 1 1 2 because while at second write resulting 1 because post increment, but shouldn't it become 2 now at third write?
Task B question
I expected the result from task B are 1 1 1 because although at second part it is post increment, but shouldn't it become 1 at third write because int b = 1 and c = b?
Thanks.