Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
>
Operator precedence in C and C++

Operator precedence in C and C++

Jul 19 2021

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 precedence. The operation execution order can be regulated by use of parentheses.

Priority/image1.png

Table 1. Operation precedence 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.

Note. The PVS-Studio analyzer provides several diagnostics such as V648. These diagnostics help detect errors related to operator precedence. Try to check your code.

References

Popular related articles


Comments (0)

Next comments next comments
close comment form