Alastair’s Place

Software development, Cocoa, Objective-C, life. Stuff like that.

C Operator Precedence

Far too many people don't know how the operator precedence works for C, Objective C or C++, which means they write code that would scare even a Lisp programmer (i.e., far, far too many parentheses [that's brackets, for those that don't know]). This isn't helped by the fact that it's hard to find a precedence table; even the specification doesn't contain one (the precedence information is encoded in the grammar rules in the spec.).

Anyway, here's a precedence table that I've written based on the C99 spec.