-1
#include <stdio.h>

int main() { int i=0; printf("%d %d %d %d %d %d", i++, i++, i++, i++, i, i++);

return 0;
}
Mat
  • 202,337
  • 40
  • 393
  • 406

1 Answers1

0

Compiler can evaluate the code in whatsoever way it wants.

But what is specified by the standard, is that modifying the same variable twice in one operation is undefined behavior; ISO C++03, 5[expr]/4:

You should not write print the statements this way for unary operators.

Jayesh
  • 3
  • 5