Proven C Book한국어 GitHub

Appendix A — Operator lookup

Operators are explained in chapter 49, “Expressions and operators”. That chapter gives each operator as a contract — operand constraints, result type, grey zones — and says why each rule is the way it is. This appendix does not repeat any of that. What is here is the one-page table you scan when a piece of code stops making sense.

Platform note. What this appendix rests on

Checked against the expressions clause (§6.5) of ISO/IEC 9899:2024 (C23). If you need to cite a rule, cite the published standard as appendix D explains.

Precedence and associativity

The higher up, the more strongly it binds. Associativity decides which side groups first when operators of the same strength stand side by side — a - b - c is (a - b) - c because it is left-associative, and a = b = 0 is a = (b = 0) because assignment is right-associative.

groupoperatorsassoc.why it associates that way
postfix() [] . -> ++(post) --(post), compound literalL→Ra.b.c only makes sense burrowing from the left
unary++ -- + - ! ~ (type) * & sizeof alignofR→Lthe nearest one binds first: - -x, *&x
multiplicative* / %L→Rthe convention of arithmetic
additive+ -L→Rsubtraction only makes sense left-associative
shift<< >>L→Ra << 1 << 2 pushes in turn
relational< <= > >=L→Rwhich is why x < y < z differs from mathematics
equality== !=L→R
bitwise AND&L→R
bitwise XOR^L→R
bitwise OR|L→R
logical AND&&L→Rshort-circuiting only works from the left
logical OR||L→Rthe same reason
conditional?:R→Lso a ? b : c ? d : e reads as a ladder
assignment= += -= *= /= %= &= ^= |= <<= >>=R→Lso that a = b = 0 makes both zero
comma,L→Rthe left is done first and discarded

Table 99.1

Places where people slip

what was writtenhow it really groupsif that was the intent
a & b == ca & (b == c)(a & b) == c
a << 1 + 2a << (1 + 2)(a << 1) + 2
*p++*(p++)(*p)++
*p.x*(p.x)(*p).x or p->x
(int)x + y((int)x) + y(int)(x + y)
a = b = 0a = (b = 0)(as it is — right-associative)
x < y < z(x < y) < zx < y && y < z
!x & y(!x) & y!(x & y)
sizeof a + 1(sizeof a) + 1sizeof(a + 1)
a ? b : c = d(a ? b : c) = d (usually an error)a ? b : (c = d)

Table 99.2

The first two lines are counted among C’s famous design scars — that the bitwise operators bind more weakly than the comparisons is a trace of early C, before it had && and ||. So parentheses are effectively mandatory around a bit test. The standard itself notes in a footnote that a<b<c does not read as it does in mathematics.

Where to look instead

What you are afterWhere it is
Per-operator contracts (operands, result, grey zones)Chapter 49, “Expressions and operators”
Assignment, side effects, evaluation orderChapter 34
The rules of pointer arithmeticChapter 38
Telling UB, unspecified and implementation-defined apartChapter 52
What an implementation must documentAppendix D

Table 99.3