##You must understand the difference between & and && in C language
## The difference between & and && in #c language is as follows:&: According to bitwise AND operation,
For example: 0010&1101, the result is 0000 & is in java The bit logic operation:
eg: 2&3=2;
The analysis is as follows: The binary system of 2 is 10; the binary system of 3 is 11; after the logical &, it is 10
For example: if(a==0&&b==0), which means if a is 0 and b is 0 time, proceed to the next step.
|| 短路或。 A||B,只有当A为假的时候才会对B进行判断。若A为真,则不继续对B进行判断。 | 逻辑或。 A|B,会对A, B都进行判断 ! 逻辑非,当操作数为true时,返回false,否则返回true。
Thank you everyone for reading, I hope you will benefit a lot.
This article is reproduced from: https://blog.csdn.net/xiachong27/article/details/82119394
Recommended tutorial: "
C LanguageThe above is the detailed content of You must understand the difference between & and && in C language. For more information, please follow other related articles on the PHP Chinese website!