C OPERATORS,
OPERANDS,
EXPRESSIONS &
STATEMENTS 1/46
,C OPERATORS
Unary Operators
Unary plus maintains the value of the operand.
+ Any plus sign in front of a constant is not part +aNumber
of the constant.
Unary minus operator negates the value of the
operand. For example, if num variable has the
- value 200, -num has the value -200. Any -342
minus sign in front of a constant is not part of
the constant.
6/46
, C OPERATORS
You can put the ++/-- before or after the operand. If it appears before
the operand, the operand is incremented/decremented. The
incremented value is then used in the expression. If you put the ++/--
after the operand, the value of the operand is used in the expression
before the operand is incremented/decremented.
Post-increment. After the result is obtained,
++ aNumber++
the value of the operand is incremented by 1.
Post-decrement. After the result is obtained,
-- the value of the operand is decremented by aNumber--
1.
Pre-increment. The operand is incremented
++ by 1 and its new value is the result of the ++yourNumber
expression.
Pre-decrement. The operand is decremented
-- by 1 and its new value is the result of the --yourNumber
expression. www.tenouk.com, © 7/46
OPERANDS,
EXPRESSIONS &
STATEMENTS 1/46
,C OPERATORS
Unary Operators
Unary plus maintains the value of the operand.
+ Any plus sign in front of a constant is not part +aNumber
of the constant.
Unary minus operator negates the value of the
operand. For example, if num variable has the
- value 200, -num has the value -200. Any -342
minus sign in front of a constant is not part of
the constant.
6/46
, C OPERATORS
You can put the ++/-- before or after the operand. If it appears before
the operand, the operand is incremented/decremented. The
incremented value is then used in the expression. If you put the ++/--
after the operand, the value of the operand is used in the expression
before the operand is incremented/decremented.
Post-increment. After the result is obtained,
++ aNumber++
the value of the operand is incremented by 1.
Post-decrement. After the result is obtained,
-- the value of the operand is decremented by aNumber--
1.
Pre-increment. The operand is incremented
++ by 1 and its new value is the result of the ++yourNumber
expression.
Pre-decrement. The operand is decremented
-- by 1 and its new value is the result of the --yourNumber
expression. www.tenouk.com, © 7/46