C language operator type, C language operator
Arithmetic Operators
Operator |
Description |
+ |
Add two operands |
- |
First operand minus second operand |
* |
Multiply two operands |
/ |
Numerator divided by denominator |
% |
Remainder after modulo operation and integer division |
++ |
Incremental operation adds an integer |
-- |
Decrease by an integer |
Relational operators
Operator |
Description |
= |
Check whether the values of the two operands are equal. If the values are equal, the condition is true. |
! = |
Check whether the values of the two operands are equal. If the values are not equal, the condition changes to true. |
> |
Check whether the value of the left operand is greater than the value of the right operand. If yes, the condition is true. |
< |
Check whether the value of the left operand is smaller than the value of the right operand. If yes, the condition is true. |
> = |
Check whether the value of the left operand is greater than or equal to the value of the right operand. If yes, the condition is true. |
<= |
Check whether the value of the left operand is smaller than or equal to the value of the right operand. If yes, the condition is true. |
Logical operators
Operator |
Description |
&& |
Logic and operators. If both operands are non-zero, the condition is true. |
| |
Logic or operator. If any two operands are non-zero, the condition is true. |
! |
The logical non-operator reverses the logic status of the operand. If the condition is true, the logical non-operation result is false. |
Bitwise operators
Operator |
Description |
& |
Binary AND Operator copies a bit to the result if it exists in both operands. |
| |
Binary OR Operator copies a bit if it exists in either operand. |
^ |
Binary XOR Operator copies the bit if it is set in one operand but not both. |
~ |
Binary Ones Complement Operator is unary and has the effect of 'flipping' bits. |
< |
Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. |
> |
Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. |
Value assignment operator
Operator |
Description |
= |
Value assignment operator. The value is assigned to the left operand from the right operand. |
+ = |
Add the value assignment operator, add the Left and Right operands, and assign the result to the left operand. |
-= |
Subtraction value assignment operator, subtract the Left and Right operations, and assign the result to the left operations |
* = |
Multiplication and value assignment operators: multiply the Left and Right operands and assign the result to the left operands. |
/= |
Division assignment operator, Division the Left and Right operations, and assigning the score to the left operations. |
% = |
Modulus assignment operator, which uses two operands for modulus and assigns the result to the left operand. |
<= |
Shift left and assign values to operators. |
>>= |
Shift right and assign values to operators. |
& = |
Bitwise AND value assignment operators. |
^ = |
Returns the bitwise exclusive or assigned value operator. |
| = |
Bitwise OR and value assignment operator. |
Conditional Operators
Operator |
Description |
? : |
Conditional expression. |
Comma Operator
Operator |
Description |
, |
It is used to combine several expressions into one expression. |
Pointer Operator
Operator |
Description |
& |
Returns the address of a variable. |
* |
The Pointer Points to a variable. |
Special operators
Operator |
Description |
Sizeof () |
Returns the variable size. |
() |
Forced type conversion/(expression)/function (parameter list ). |
[] |
Array subscript. |
. |
Member operator. |
-> |
Member operator. |