M3S2 Part 3 Flashcards
the symbols that tell the compiler to perform specific
mathematical or logical manipulations.
Operators
Types of Operators
- Assignment Operator
- Arithmetic Operators
- Compound Operators
- Relational Operators
- Logical Operators
a single equal sign (=) which
means that the value on the right side of the assignment expression
after the equal sign is assigned to the variable on the left.
assignment operator
specifies the
order of operations in expressions
that contain more than one operator.
Operator precedence
compound operators:
+= , -= , *= , /=, %=
y+= x; is equivalent to?
y = y+x
++ adds 1 to its operand
increment operator
– subtracts 1 from its operand.
decrement operator
Both the increment and decrement operators can either
precede
(prefix) or follow (postfix) the operand.
operators that allow the comparison of two or more numerical values, yielding a result based on whatever the comparison is true(1) or false(0).
relational operators
These operators are used to combine two or more conditions or to complement the evaluation of the original condition in consideration.
logical operators
The
result of the operation of a
logical operator is a
boolean
value either true or false
If both the operators are non-zero, then condition becomes true.
&& Logical AND operator
If any of the two operands is non-zero, then the condition becomes true
Logical OR Operator. ||
Use to reverses the logical state of its operand. If a condition is true, then this operator will make false
! Logical NOT Operator