Node:Precedence of operators, Next:, Previous:Reserved words in C, Up:Top



Precedence of operators

The highest priority operators are listed first.

Operator         Operation                     Evaluated

    ()              parentheses                   left to right
    []              square brackets               left to right

    ++              increment                     right to left
    --              decrement                     right to left
  (type)            cast operator                 right to left
    *               the contents of               right to left
    &               the address of                right to left
    -               unary minus                   right to left
    ~               one's complement              right to left
    !               logical NOT                   right to left

    *               multiply                      left to right
    /               divide                        left to right
    %               remainder (MOD)               left to right

    +               add                           left to right
    -               subtract                      left to right

    >>              shift right                   left to right
    <<              shift left                    left to right

    >               is greater than               left to right
    >=              greater than or equal to      left to right
    <=              less than or equal to         left to right
    <               less than                     left to right

    ==              is equal to                   left to right
    !=              is not equal to               left to right

    &               bitwise AND                   left to right
    ^               bitwise exclusive OR          left to right
    |               bitwsie includive OR          left to right
    &&              logical AND                   left to right
    ||              logical OR                    left to right

    =               assign                        right to left
    +=              add assign                    right to left
    -=              subtract assign               right to left
    *=              multiply assign               right to left
    /=              divide assign                 right to left
    %=              remainder assign              right to left
    >>=             right shift assign            right to left
    <<=             left shift assign             right to left
    &=              AND assign                    right to left
    ^=              exclusive OR assign           right to left
    |=              inclusive OR assign           right to left