Throughout our C programs thus far, we have used operators like +, =, and ++ in expressions such as
x = 9 + 3;We mean by this that 9 and 3 should be added together and the result assigned to variable x. We assumed that the + operator has higher precedence than the = operator. Our assumption was correct, but it's because the C language followed our intuition about operator precedenceC programming language!operators!precedence of and associativityC programming language!operators!associativity of.
lists all C operators through the C99 standard in order of their precedence (highest to lowest).1 Operators within the same division have equal precedence.
Think of the compiler considering an expression and interpreting its meaning. The operators in the expression tell it what to do with the operands, …
This is a preview. Read the full book in print or ebook — get it from MIT Press (ISBN 9780262548762).
Instructor with access? Instructor login.