Mikroelektronika MIKROE-442 데이터 시트
222
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
Unary Operators
Unary operators are operators that take exactly one argument.
Unary Arithmetic Operator
Operator
-
can be used as a prefix unary operator to change sign of a signed value. Unary prefix operator
+
can be
used also, but it doesn’t affect data.
For example:
b = -a
Unary Bitwise Operator
The result of the
not
(bitwise negation) operator is the bitwise complement of the operand. In the binary representation
of the result, every bit has the opposite value of the same bit in the binary representation of the operand.
Operator
Operation
not
bitwise complement (unary); inverts each bit
Example:
not 0x1234 ‘ equals 0xEDCB
Address and Indirection Operator
In the mikroBasic PRO for dsPIC, address of an object in memory can be obtained by means of an unary operator
@
.
To reach the pointed object, we use an indirection operator
^
on a pointer. See Pointers section for more details.
Operator
Operation
^
accesses a value indirectly, through a pointer; result is the value at the address to
which operand points
@
constructs a pointer to its operand
See Pointers for more details on this subject
Note: Besides these, sizeof and explicit conversion unary operators are supported also.