0

I am finding difficulty to understand how precedency works in the following case. Can anyone explain why the answer is different in below two printf functions?

int main()
{

    int a=10,b=20,c;
    c= a++ + ++a - --b - b-- + ++a;
    printf("%d\n",c);
    printf("%d",a++ + ++a - --b - b-- + ++a);
    return 0;
}
dbush
  • 205,898
  • 23
  • 218
  • 273
  • 2
    not sure why every professor has to trouble students with these kinds of nonsense - which nobody uses in real code – artm Dec 29 '21 at 05:09
  • 1
    This is a classic example of undefined behaviour. A waste of time trying to understand or explain. – Cheatah Dec 29 '21 at 05:14

0 Answers0