Doubt in C increment operator -
possible duplicate:
post , pre increment in c
i new c, have increment operator program in c
#include<stdio.h> main(){ int a, b; = 2; b = + ++a + ++a; printf("%d", b); getchar(); }
the output 10, can explain me how output 10 .
this undefined, ++i
can happen in order.
function call arguments ambigiously evaluated, e.g. foo(++i,++i)
.
not operator chains undefined, a||b||c
guaranteed left-to-right, example.
the guarantees made in places known sequence points although terminology being deprecated , clarified in c++0x.
what's odd in example neigher 2+3+4 nor 4+4+3 happened, compiler evaluated left side first in 1 step , right side first in other. optimisation flatten depencency graph.
Comments
Post a Comment