Operator, Operand and Arithmetic
Operator: a symbol used to process values for a new one. (the operations)
Operand: specifies which data will be operated on. (the values)
Operator types:
- Assignment Operator (x = y, where y is constant, another variable, an expression or a function)
- Arithmetic Operator (“+”, “-“, “*”, “/”, “%”, “++”, “–” and “()”)
- Relational Operator (“==”, “!=”, “<“, “>”, “<=”, “>=” and “?:”)
- Logical Operator (“&&”, “||” and “!”)
- Bitwise Operator (“&”, “|”, “^”, “~”, “>>” and “<<“)
- Pointer Operator (not yet discussed)
Precedence: the order of operator execution based on priority. (like how multiplication is done before addition)
Associative: the order of operator execution based on its location inside an expression. (like how 12+10-15 is done from the most right first)
And we learned binary!
- 0 0 0 0 0 0 0 0 = 0
- 0 0 0 0 0 0 0 1 = 1
- 0 0 0 0 0 0 1 0 = 2
- 0 0 0 0 0 1 0 0 = 4
- 0 0 0 0 1 0 0 0 = 8
- 0 0 0 1 0 0 0 0 = 16
- 0 0 1 0 0 0 0 0 = 32
- 0 1 0 0 0 0 0 0 = 64
- 1 0 0 0 0 0 0 0 = 128
- etc.