Home > Backend Development > C#.Net Tutorial > What is the precedence of logical operators in C language?

What is the precedence of logical operators in C language?

angryTom
Release: 2020-03-03 17:49:59
Original
17108 people have browsed it

What is the precedence of logical operators in C language?

#What is the priority of logical operators in C language?

C language provides the following three logical operators.

● One Yuan:! (logical not).

● Binary: && (logical AND), || (logical OR).

Recommended: "C Language Video Tutorial"

Among the above three logical operators, logical NOT! has the highest priority, logical AND && followed by , logical OR || has the lowest priority . That is, the priority order of arithmetic, logical, and assignment operators is:

logical NOT! >arithmetic> logical AND&&, logical OR|| > assignment=

The value of a logical expression is a logical value, that is, Boolean type (bool). This type is new in C99. Some compilers may not support this type yet.

Logical values ​​are divided into logical true values ​​and logical false values. Under normal circumstances, during judgment, only zero values ​​are judged as logical false values ​​(false), and all non-zero values ​​can be judged as logical true values ​​(true); when storing and representing, usually, 1 is used to represent logical values. True value, 0 represents a logical false value.

The operation rules of logical AND && operator: The result is true only when both operands are logically true. In all other cases, the result is false.

The operation rules of logical OR || operator: The result is false only when both operands are logically false. In all other cases, the result is true.

For more C language tutorials, please pay attention to PHP Chinese website!

The above is the detailed content of What is the precedence of logical operators in C language?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template