Operators

Arithmetic Operators

  • +, ΓÇô , *, / and the modulus operator %.
  • and ΓÇô have the same precedence and associate left to right.
    3 – 5 + 7 = ( 3 – 5 ) + 7  3 – ( 5 + 7 )
    3 + 7 ΓÇô 5 + 2 = ( ( 3 + 7 ) ΓÇô 5 ) + 2
  • *, /, % have the same precedence and associate left to right.
  • The +, ΓÇô group has lower precedence than the *, / % group.
    3 ΓÇô 5 * 7 / 8 + 6 / 2
    3 ΓÇô 35 / 8 + 6 / 2
    3 ΓÇô 4.375 + 6 / 2
    3 ΓÇô 4.375 + 3
    -1.375 + 3
    1.625

The following table shows all the arithmetic operators supported by the C language. Assume variable A holds 10 and variable B holds 20 then

Logical Operators