+ 2

increment operator: what's the output?

What's the output of this code? The right answer may be surprising to you! I'll post the right answer if no one answers. in a a week. #include <iostream> using namespace std; int main() { int i = 5; i = ++i + i++; cout<<i<<endl; return 0; }

11th Oct 2016, 4:50 AM
Bill
Bill - avatar
2 ответов
+ 1
13
11th Oct 2016, 5:54 AM
Balaji Rs
Balaji Rs - avatar
+ 1
undefined. It depends on the compiler. 12 or 13.
11th Oct 2016, 6:46 AM
marcram