+ 1
can anyone help me?
int main() { int a = 4, b; b = a + ++a; cout<<b; return 0; } why does this code outputs 10 as b?
1 Answer
+ 2
First thing it does is the ++a, so it will set a to 5 and you're left with b = a + a so b = 5 + 5 = 10
int main() { int a = 4, b; b = a + ++a; cout<<b; return 0; } why does this code outputs 10 as b?