What are the final values of a, b and c?
int main() {
int a, b, c;
a = 9;
c = a + 1 + 1 * 0;
b = c++;
}Show answer and explanation
The final values are a == 9, b == 10, and c == 11. Multiplication happens before addition, so c first becomes 10; postfix c++ assigns that old value to b and then increments c.
The final values are a == 9, b == 10, and c == 11. Multiplication happens before addition, so c first becomes 10; postfix c++ assigns that old value to b and then increments c.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.