the rule governs that in && exprns on both the side gets evaluated only if first exprns gives TRUE if 1st one gives FALSE then whatever be 2nd exprn answer be FALSE and in || 2nd side is not evaluated if 1st side replies with TRUE..
On Dec 13, 9:10 pm, siva viknesh <[email protected]> wrote: > int main() > { > int k = 5; > if (++k < 5 && k++/5 || ++k <= 8); > printf("%d\n", k); > return 0; > > } > > for the above code output is '7' and not '8'...why?? > > int main() > { > int k = 5; > if (++k < 5 && k++/5 ); > printf("%d\n", k); > return 0; > > } > > similarly for the above code output is '6' and not '7'...why?? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
