短路求值

#include<iostream>
using namespace std;
int main()
{
    int a=3,b=3;
    (a=0)&&(b=5);
    printf("a=%d,b=%d
",a,b); 
    (a=1)||(b=5);
    printf("a=%d,b=%d",a,b); 
} 

a=0为假所以没有对B进行操作

a=1为真,所以没有对b进行操作

原文地址:https://www.cnblogs.com/helloworld2019/p/11082051.html