Parentheses are classed as operators by the compiler, although their position
is a bit unclear. They have a value in the sense that they assume the value
of whatever expression is inside them. Parentheses are used for forcing a
priority over operators. If an expression is written out in an ambiguous way,

such as:

a + b / 4 * 2

it is not clear what is meant by this. It could be interpreted in several ways:

((a + b) / 4) * 2
or
(a + b)/ (4 * 2)
or
a + (b/4) * 2



and so on. By using parentheses, any doubt about what the expression
means is removed. Parentheses are said to have a higher priority than + *
or / because they are evaluated as "sealed capsules" before other operators
can act on them. Putting parentheses in may remove the ambiguity of
expressions, but it does not alter than fact that

a + b / 4 * 2

is ambiguous. What will happen in this case? The answer is that the C
compiler has a convention about the way in which expressions are evaluated:
it is called operator precedence. The convention is that some operators are
stronger than others and that the stronger ones will always be evaluated first.
Otherwise, expressions like the one above are evaluated from left to right: so
an expression will be dealt with from left to right unless a strong operator
overrides this rule. Use parentheses to be sure. A table of all operators and
their priorities is given in the reference section.
Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates