The meaning of "|" in C language
In C language, the "|" symbol is a bitwise OR operator. It performs the following operations:
Bitwise OR operation
The bitwise OR operation compares the corresponding bits of two binary numbers and gives the following result:
For example, 10 (01010) and 5 (00101) are bitwise ORed:
<code>01010 | 00101 -------- 01111</code>
The result is 01111 (15).
Syntax
The syntax of the bitwise OR operation is as follows:
<code class="c">expression1 | expression2</code>
Among them, expression1
and expression2
are two integer expressions that need to be ORed.
Application
The bitwise OR operation is widely used in the following situations:
The above is the detailed content of What does | mean in c language?. For more information, please follow other related articles on the PHP Chinese website!