Two types of operators: Unary Binary Unary examples -a - negate *a_num - dereference an address &num - take address from an variable Binary operators a - b - subtraction a + b - addition a * b - multiplication Bitwise and Symbol: & Logical equivelent: && 01101001 & 10110101 ---------- 00100001 Bitwise or Symbol: | Logical equivelent: || 01101001 | 10110101 ---------- 11111101 Bitwise xor Symbol: ^ Logical equivelent: != 01101001 ^ 10110101 ---------- 11011100 Applications Clear bit: 10010110 & 11111011 ---------- 10010010 10010110 | 00100000 ---------- 10110110 Is the 5th bit set? 10010110 & 00010000 ---------- 00010000 Bit shift Left bit shift: << Right bit shift: >> 10010110 << 2 = 01011000 unsigned 10010110 >> 2 = 00100101 signed 10010110 >> 2 = 11100101 00010110 >> 2 = 00000101 Application: make a single bit at a given index 00000001 << i 00000001 << 4 = 00010000 Inversion, bitwise not Symbol: ~ Somewhat comparable to - ~01101001 = 10010110 -01101001 = 10010111