Operation priorities in C/C++

2017-11-27 10:13:20 来源: https://www.viva64.com/en/t/0064/ 发布人:

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++.

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.

References


阅读次数: 2144

下一篇: c++中string类的详解
上一篇: 一、类模板定义及实例化

尚无评论!

返回上一页面