September 1998
Intermediate to advanced
848 pages
20h 13m
English
C offers bitwise logical operators and shift operators. In the following examples, we will write out values in binary notation so that you can see what happens to the bits. In an actual program, you would use integer variables or constants written in the usual forms. For instance, instead of 00011001, you would use 25 or 031 or 0x19. For our examples, we will use 8-bit numbers, with the bits numbered 7 to 0, left to right.
The four bitwise logical operators work on integer-type data, including char. They are called bitwise because they operate on each bit independently of the bit to the left or right. Don't confuse them with the regular logical operators (&&, ||, and !), which operate on values ...
Read now
Unlock full access