Operators are used with operands to build expressions. For example the following is an expression containing two operands and one oprator.

4 + 5

The following list of operators is probably not complete but does highlight the common operators and a few of the outrageous ones....

C contains the following operator groups.

The order (precedence) that operators are evaluated can be seen here.

+ - / * % modulo -- Decrement (post and pre) ++ Increment (post and pre)

These all perform an arithmetic operation on the lvalue and assign the result to the lvalue. So what does this mean in English? Here is an example:

counter =index.html counter + 1;

can be reduced to

counter +=index.html 1;

Here is the full set.

=index.html *= Multiply /=index.html Divide. %=index.html Modulus. +=index.html add. -=index.html Subtract. <<=index.html HREF="assignment.html" left shift. >>=index.html Right shift. &=index.html Bitwise AND. ^=index.html bitwise exclusive OR (XOR). |=index.html bitwise inclusive OR.

==index.html Equal to != Not equal to > = <=index.html && HREF="logical.html" Logical AND || Logical OR ! Logical NOT

& AND (Binary operator) | inclusive OR ^ exclusive OR << HREF="/~garyg/C_ref/C/CONCEPT/bit_shift.html" shift left >> shift right ~ one's complement

sizeof() size of objects and data types. strlen may also be of interest. & Address of (Unary operator) * pointer (Unary operator) ? Conditional expressions : Conditional expressions , Series operator.

Top | Master Index | Keywords | Functions |

Martin Leslie 15-Nov-95