operator precedence and associativity in C

Home Forums C-programming.. operator precedence and associativity in C

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2134 Reply
    Humble
    Keymaster

    A must know ..! There are different operators in C and its precedence over other and associativity between them is an integral part of understanding how the program expected to work.. if we dont have proper idea on the same, we are almost lost.. so take a look at any reference table which list the same.

    Below can be a reference which list the precedence and associativity.

    http://www.swansontec.com/sopc.html

    #2135 Reply
    Humble
    Keymaster
    This reply has been marked as private.
    #2137 Reply
    Humble
    Keymaster

    One more reference table for operator precedence and associativity.

    http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm

    #2239 Reply
    Humble
    Keymaster
    This reply has been marked as private.
    #2300 Reply
    Humble
    Keymaster

    The order in which operators are evaluated is called operator precedence or the order of operations.

    Unary operators ( ++ — + – ) order of evaluation is from right to left, so an expression like:

    *p++;

    would perform the ++ before the *

    The comma operator (,) works almost like the semicolon ; that separates one C statement from another. The comma-separated expressions are evaluated from left to right.

    #2302 Reply
    Humble
    Keymaster
    This reply has been marked as private.
    #2319 Reply
    Humble
    Keymaster
    This reply has been marked as private.
Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: operator precedence and associativity in C
Your information: