User manual

248
mikoC PRO for dsPIC
MikroElektronika
Unary Logical Operator
The ! (logical negation) operator produces the value 0 if its operand is true (nonzero) and the value 1 if its operand is
false (0).
Operator Operation Precedence
! logical negation 14
The following two expressions are equivalent:
!right;
right == 0;
Unary Bitwise Operator
The result of the ~ (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 Precedence
~ bitwise complement (unary); inverts each bit 14
Address and Indirection Operator
In the mikroC PRO for dsPIC30/33 and PIC24, 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 Precedence
* accesses a value indirectly, through a pointer; result
is the value at the address to which operand points
14
& gives the address of its operand 14
Example:
int *p_to_y; // p_to_y is dened as a pointer to an int
int y; // y is dened as an int
p_to_y = &y; // assigns the address of the variable y to the pointer p_to_y
*p_to_y = 3; // causes the variable y to receive the value 3
Note: Besides these, sizeof and casting unary operators are supported also.