Current location - Training Enrollment Network - Mathematics courses - What are logical operators, arithmetic operators and relational operators?
What are logical operators, arithmetic operators and relational operators?
The logical operators in C language are or (||) and (&; &), not (! ), respectively corresponding to OR, AND and NOT operations in propositional logic.

Logical operator: or ||. In propositional logic, when P= 1 or Q= 1, P||Q is equal to 1.

Logical operators: and &;; & amp。 In propositional logic, when P= 1 and Q= 1, P &;; & ampq is equal to 1.

Logical Operator: No! . In propositional logic, when p equals 0! P equals 1, and vice versa.

Operation symbols in c language

More specifically, the bits are shifted to the right (>; >) operator can be an arithmetic shift (most significant bit on the left) or a logical shift (zero on the left). For example, if1111is shifted to the right by 3 digits, it will become11100 after arithmetic right shift, and the logic will be shifted to the right. Almost all compilers will shift the arithmetic bit to the right because it is more suitable for dealing with integers with negative signs.

The priority of operators from high to low is monocular operator, arithmetic operator, relational operator, logical operator, conditional operator, assignment operator (=) and comma operator.

The above contents refer to Baidu Encyclopedia -C language.