Mikroelektronika MIKROE-738 Datenbogen

Seite von 682
246
mikoC PRO for PIC32
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 PIC32, 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 defined as a pointer to an int
 int y;          // y is defined 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.