Operation priorities in C/C++

Any language expression consists of operands (variables, constants, etc.) connected with each other by operators. Operations are executed in a strict order. The value that determines a privilege to execute a certain operation is called a priority. The operation execution order can be regulated by use of parentheses.


Table 1. Operation priorities in C/C++.

You may often see errors in programs which are caused by the fact that it is easy for programmers to forget the exact priorities of operations (article on the topic). This is why professional developers do not feel embarrassed about using additional parentheses: this method secures them from accidental mistakes, and makes expressions more readable.


  1. Wikipedia. Operators in C and C++. https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.