基本原则为:从左向右,当前逻辑表达式不满足立刻停止后续验证
code
// test.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <stdlib.h>
int main(void)
{
int m=0;
int n=0;
if(m==1 && ++n==1)
{
printf("It is OK!\n");
}
printf("The first n=%d\n",n);
if(++n==1 && m==1)
{
printf("It is in!\n");
}
printf("The second n=%d\n",n);
system("pause");
return 0;
}
原文地址:http://blog.csdn.net/cjc211322/article/details/37598685