Lecture7 C Operators
Lecture7 C Operators
operators
Arithmetic Operators
An operator is a symbol that tells the compiler to perform specific mathematical
or logical functions.
C allows *= += /= -= operators.
For example: int i = 5; i *= 5; The int i would have the value 25 after the
operation.
The two arithmetic operators that
are used frequently are ++ and --.
You can place these in front or at
the back of variables.
++ specifies incrementing.
-- specifies decrementing.
If the operator is placed in front, it
is prefix but if it is placed behind, it
is postfix.
Prefix means, increment before
any operations are performed,
postfix is increment afterwards.
These are important
considerations when using these
operators.
© Prof Suvendi Rimer, UJ
Assignment Operators