ProgrammingVery hard

int i = 3; int j = i-- - --i; printf("%d %d", i, j); What is printed?

  1. A. 1 2
  2. B. undefined behaviour, because i is modified twice without a sequence point
  3. C. 2 1
  4. D. 1 1

Correct answer: B. undefined behaviour, because i is modified twice without a sequence point

The two modifications of i are unsequenced relative to each other, so the program has undefined behaviour and no output can be relied on.

More C Programming questions

Exams that ask this topic