Appendix C. Operator Precedence

It is a good practice to use parentheses that explicitly compartmentalize your operations. In absence of those parentheses, the compiler resorts to a predefined order of precedence in which the operators are used. This operator precedence, as listed in Table C.1, is what the C++ compiler adheres to in event of ambiguity.

Table C.1. The Precedence of Operators

Image

Get Sams Teach Yourself C++ in One Hour a Day, Seventh Edition 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.