int a = 6;
int b = a + a++;
answer is 12
int a = 6;
int c = a++ + a;
answer is 13
why are the answers for b and c are different ? since postfix has higher a precedence value, then the answer for both should be 13 right?
int a = 6;
int b = a + a++;
answer is 12
int a = 6;
int c = a++ + a;
answer is 13
why are the answers for b and c are different ? since postfix has higher a precedence value, then the answer for both should be 13 right?
Copyright © 2021 Jogjafile Inc.
In the first example, you incremented the value of
ain the second operand, so it doesn't affect the value of the first operand. But, in the second example, you incremented the value ofain the first operand, so it affects the value of the second operand.