I had written a program in C to print different values of a
This is the code:
int main(void)
{
int a = 10;
printf("%d %d %d %d", a++, ++a, a--, --a);
return 0;
}
The output is:
9 10 9 10
But how the output is decided to print like this?
Also how the output will be decided for x
, if I use them in the expression as : int x = ++a + ++a;
or int x = a++ - --a + a--;
or something like this.
Is it something to do with the precedence order or something different is there? Please explain this to me that how the output of these two things are decided?