Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)
I am having this confusion in the Operator preference of && ++ and *****
int i=-1,k=-1,y,n;
y=++i*++i;
n=++k&&++k;
printf("%d %d %d %d",i,y,k,n);
output gcc : 1 1 0 0
here, for the case of y initially i is incremented once i.e i=0 and again i is incremented i.e i=1 now i*i is done i.e 25 since ++ has higher precedence than *
in second case k doesnot increment to 1 even though ++ has higher preference than && .Can anyone please explain this phenomenon??