+ 1
what is output of x += x +=x++ ;
int x ; x=0; x += x +=x++ ; cout << x ; and why ??
2 Respuestas
+ 4
Given x starts as an uninitialized random value, it could be anything. If you initialize it to zero on declaration, it should work, but I tried to run it and got 'compilation error' as my output. What I expected to happen is:
int x = 0;
x++; // 1
x += x; // 2 for right assignment
x += x; // 4 for left assignment