#include <stdio.h>
int main(void)
{
int a = 1, i = 3, x, y, z;
a = 1; i = 3;
x = a+++i;
a = 1; i = 3;
y = a++ + i;
a = 1; i = 3;
z = a + ++i;
printf("%d %d %d", x, y, z);
scanf(" ");
return 0;
}
This code output appears to be 4 4 5
. But why is a+++i
equals to a++ + i
?
Is it because compilers always read source code from left to right?
Or is it because the operation follows the order of precedence?
And will it work the same on all compilers?