Appendix A C++ Operators

Table A1 in this section lists C++ operators by precedence, associativity, description, and syntax. The precedence levels—to which I’ve assigned numbers—have no significance beyond the fact that all operators at the same level have equal precedence.

Association can be left to right or right to left. This difference matters when two operators are at the same level of precedence. For example, in the expression

    *p++

the * and ++ operators are at the same level of precedence (level 2), so the order of evaluation is determined by associativity—in this case right to left. The expression is therefore evaluated as if written this way:

    *(p++)

meaning that it is the pointer p itself (not what it points to) that gets incremented. ...

Get C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.