<C Primer Plus>10 The Sequence points && and ||

while((c = getchar()) != ' ' && c  != '\n')
The first subexpression gives a value to c ,which then is used in the second subexpression.

while(x++ < 10 && x + y < 20)
The fact that the && operator is a sequence piont guarantees that x is incremented before the expression on the right is evaluated.

if (number != 0 && 12/number == 2)
    printf("The number is 5 or 6.\n");
if the first subexpression is false,  the relational expression is not evaluate any further.

 

posted @ 2017-04-03 11:50  Micheal_you  阅读(121)  评论(0编辑  收藏  举报