Home >Backend Development >C#.Net Tutorial >c language 'or' symbol

c language 'or' symbol

angryTom
angryTomOriginal
2019-11-19 09:58:3195921browse

c language 'or' symbol

c language "or" symbol

The or symbol in c language is "||", It is a binary operator, which means that as long as the left and right expressions satisfy one of them, it will return true.

Keys: Shift \ (the symbol above Enter)

Logical operators (Recommended courses: C Language Tutorial)

● “&&” means AND, which means both must be satisfied at the same time.

● “||” means or, meaning two or more as long as one of them is satisfied.

● “!” means negating the condition.

In C language, && and || are both logical operators, and they are both binary operators.

There are three logical operators in total, namely "&&", "||" and "!".

a) a && b, if one is false, it must be false, and the associativity is from left to right.

b) || is the logical OR operator, a || b, if one is true, it must be true, and the associativity is from left to right.

c) && and || are logical operators in Java, PHP and c#, also called conditional operators.

Extended information:

In C language && is a binary operator, which represents AND operation. When the expression or variable given on the left is 0, The right side is no longer evaluated, and the entire expression is zero.

Logical operators are used to judge whether a thing is "established" or "not established", or "true" or "false". The result of the judgment has only two values, which is represented by a number as "0" ” and “not 0”.

Among them, "non-0" means that the result of the logical operation is "true", and "0" means that the result of the logical operation expression is "false".

The above is the detailed content of c language 'or' symbol. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn