Mikroelektronika MIKROE-738 Datenbogen
mikroC PRO for PIC32
MikroElektronika
237
Arithmetic Operators
Arithmetic operators are used to perform mathematical computations. They have numerical operands and return
numerical results. The type
char
technically represents small integers, so the
char
variables can be used as operands
in arithmetic operations.
All arithmetic operators associate from left to right.
Arithmetic Operators Overview
Operator
Operation
Precedence
Binary Operators
+
addition
12
-
subtruction
12
*
multiplication
13
/
division
13
%
modulus operator returns the remainder of integer division
(cannot be used with floating points)
13
Unary Operators
+
unary plus does not affect the operand
14
-
unary minus changes the sign of the operand
14
++
increment adds one to the value of the operand. Postincrement
adds one to the value of the operand after it evaluates; while
preincrement adds one before it evaluates
14
--
decrement subtracts one from the value of the operand.
Postdecrement subtracts one from the value of the operand
after it evaluates; while predecrement subtracts one before it
evaluates
14
Note: Operator
*
is context sensitive and can also represent the pointer reference operator.