#include <stdio.h>
#include <stdlib.h>
int main()
{
int a=0;
int b=1;
int c=0;
int d=1;
if(1!=1&&(a++)<2){
}else{
printf("&&resut =%d \n ",a);
}
if(1==1||(b++)<2){
printf("||resut =%d \n ",b);
}
if(1!=1&(c++)<2){
}else{
printf("&resut1 =%d \n ",c);
}
if(1==1|(d++)<2){
printf("|resut1 =%d \n ",d);
}
return 0;
}
运行结果:
&&resut =0
||resut =1
&resut1 =1
|resut1 =2
Process returned 0 (0x0) execution time : 0.123 s
Press any key to continue.
可以看到,它们和java里的&&和&,||和|是一样的。
我的关于java里的&&和&,||和|的博客地址
http://blog.youkuaiyun.com/uncle_gy/article/details/77914091