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 |
not 0x1234 ' equals 0xEDCB
Address and Indirection Operator
In the mikroPascal PRO for PIC, 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
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
What do you think about this topic ? Send us feedback!