Home > Common Problem > body text

What are unary operators and binary operators?

藏色散人
Release: 2019-06-04 10:12:57
Original
40156 people have browsed it

What are unary operators and binary operators?

What is a unary operator?

Unary operator refers to an operator that requires one variable for operation, that is, there is only one operand in the operation, also called unary operator, among which there are logical NOT operators: !, press Bit negation operator: ~, increment and decrement operators: , --, etc.

Logical NOT operator [!], bitwise negation operator [~], increment and decrement operator [ , --], negative sign operator [-], type conversion operator [( Type)], pointer operator and address operator [* and &], length operator [sizeof]

What is a binary operator?

An operator that requires two variables for an operation is called a binary operator, or an operator that requires the number of operands to be 2 is called a binary operator.

Elementary operators 

Subscript operator [[]], component operator pointing to structure member operator [->], structure member operation Symbol [.]

Arithmetic operator

Multiplication operator [*], division operator [/], remainder operator [%], addition operator 【】, subtraction operator【-】

relational operator

equal operator【==】, not equal operator【!=】, relational operator 【< > <= >= 】

Logical operator

Logical AND operator【&&】, Logical OR operator【||】, Logical NOT operator [! 】

Bitwise Operator

Bitwise AND operator [&], Bitwise XOR operator [^], Bitwise OR operator [|], Left shift operator [<<], right shift operator [>>]

Assignment operator

Assignment operator[= = -= *= /= %= >>= <<= &= |= ^=】

Comma operator

Comma operator【,】

The above is the detailed content of What are unary operators and binary operators?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!