2nd Algo Class

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:

  1. Assignment Operator (x = y, where y is constant, another variable, an expression or a function)
  2. Arithmetic Operator (“+”, “-“, “*”, “/”, “%”, “++”, “–” and “()”)
  3. Relational Operator (“==”, “!=”, “<“, “>”, “<=”, “>=” and “?:”)
  4. Logical Operator (“&&”, “||” and “!”)
  5. Bitwise Operator (“&”, “|”, “^”, “~”, “>>” and “<<“)
  6. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *