+ 1
Why answer is 19?
#include <iostream> using namespace std; int main() { int x, i=4; x=++i + ++i + ++i; cout <<x; return 0; }
5 Answers
+ 9
see here for more information regarding this undefined behaviour.
http://en.cppreference.com/w/cpp/language/eval_order
+ 4
I think it does 6 + 6 + 7 (may be in another order)
Know that doing more than one increment/decrement like this is undefined in C/C++ standards so it is compiler dependant. What works with gcc might work differently with clang (same for g++ and clang++)
+ 1
yep# true
depends on compiler###
+ 1
in c it's showing answer is 21
Increment the variable I up to break point.
Step 2: Start assigning final value 7 to all variable i in the expression.
So, i=7+7+7=21
0
yeah... 3 ++i
means 4--5--6--7
now 7+7+7
but here it seems...
5+6+7+1
if two ++i
5+6+1