c - How the expression evaluates? -
this question has answer here:
can 1 draw precedence tree expression , please explain side effects..values after expression evaluation in c.
int i=-3, j=2, k=0, m; m= ++i || ++j&&++k; according me output should -2 3 1 1 gnu c compiler printing -2 2 0 1? want know how?
because j won't evaluated due short circuit evaluation:
m= ++i || ++j && ++k; ↑ at stage, m evaluated 1 regardless of right side of ||. why?
because 1 || anything 1.
Comments
Post a Comment