ProgrammingVery hard

int i = 0; printf("%d %d", i++, i); What does this code do?

  1. A. It prints 0 1
  2. B. Undefined behaviour, since i is modified and read without a sequence point
  3. C. It prints 1 1
  4. D. It prints 0 0

Correct answer: B. Undefined behaviour, since i is modified and read without a sequence point

The two arguments are unsequenced relative to each other, and i is modified and read without a sequence point. This is undefined behaviour, so it should not be used as a test.

More C Programming questions

Exams that ask this topic