0
#include<stdio.h>

int main()
{
  int i = 10;
  int d = ++i + i--;
  printf ("d = %d\n",d);
  return 0;
    }

This code printing d = 21. The order of evaluation is taken right to left and left to right, but still the answer is not evaluating to 21.

Moody
  • 111
  • 1
  • 1
    Does this answer your question? [C operator += Sequence point?](https://stackoverflow.com/questions/30457904/c-operator-sequence-point) – Stephen Newell Apr 14 '22 at 11:29
  • It would be 22 if the `d = ++i + i--` assignment was divided into 2 lines of calculation. – mcy Apr 14 '22 at 11:38

0 Answers0