Skip to main content

✍️ Practice (Unary/Binary)

1. Dangers of Unary Operators​

What is the output of the code below?

int a = 2;
int b = 3;
int c = 4;

a = ++b - c--; // this is the major line
Console.WriteLine (a+ " " + b + " " + c);

2. Dangers of Unary & Binary Operators​

What is the output of the code below?

int a, b, c; // the variables are born
a = 5;
b=3;
c = ++ b - a;
a = a + c--;
c -=a;
a = ++b + ++c;

Console.WriteLine(a + " " + b + " " + c);