CCoding Style - Parenthesize to resolve ambiguity
Parenthesize to resolve ambiguity
- C provides a very pernicious precedence problems, and it is easy to make a mistake.
- When mixing unrelated operations, it’s a good idea to parenthesize.
- Parenthesizes specify grouping and can be used to make the intent clear even when they are not required.
- Because the logical operators bind tighter than assignment, parenthesis are mandatory for most expressions that combine them, e.g,
while( (c = getchar() ) != EOF)