#include <iostream> int main() { int i=8,j=3,x; x=i++; j=++i; cout<<x; cout<<--j<<j--<<++j; return 0;} | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

#include <iostream> int main() { int i=8,j=3,x; x=i++; j=++i; cout<<x; cout<<--j<<j--<<++j; return 0;}

on running the above code output is 89119 plz explain how

7th Feb 2017, 1:02 PM
Vaaru
Vaaru - avatar
2 Answers
+ 2
It's undefined behavior. According to the standards of C and C++ side-effects (that is, the increment in this case) can be applied in any convenient for compiler the time between two sequence points.
9th Feb 2017, 6:02 PM
SUPER_S
SUPER_S - avatar
9th Feb 2017, 6:02 PM
Tomasz
Tomasz - avatar