can you please explain me this.
I have read almost all questions on stackoverflow
- undefined behaviour
- pre/post inc.. dec.. operator precedence/associativity
- use the parenthesis
but results are inconclusive.
please explain this i have an interview tomorrow.
int a, x = 0;
// value of x ------> a(sum)
//gcc 4.9.9.2[dev cpp] 2 1 2 4 5 14
//acc to my calculation 2 0 2 4 5 13
//geeksforgeeks compiler 5 5 5 5 5 15
//gcc 6.3 [codechef ide] 5 5 5 5 5 15
a = ((((++x + x++) + ++x) + ++x) + ++x);
printf("%d....%d", x, a);
return 0;
if i have made mistake please help me to correct them. Thanks