In contrast to binary operators, unary operators are only applied to one operand. The following sections look closer at the unary plus (+), the unary minus (-), the increment (++), and the decrement (--) operators.
The unary minus operator shown in the following
is not just a minus sign, as in the literals (like –18) we write on a piece of paper. It is an operator and will change the sign of the numerical expression to which it is applied. Consequently, if the variable height has the value 10, - height will return the value –10. If the value is –10, the result will be 10.
When the unary minus operator ...