Operator Precedence - Table

Many times when I refer other people’s code to contest problems, I find some people writing complex expressions without grouping them. This was hard to understand because I needed to refer the operator precedence chart and calculate the values of the expression. So, I thought of publishing the operator precedence chart in languages which I know.

The priority in all the tables decreases from top to bottom.

If you find any mistake in the chart, please let me know. I will update them.


Operator Precedence in C

Operator Precedence in C


Operator Precedence in C++

Operator Precedence in C++


Operator Precedence in Java

Operator Precedence in Java


Operator Precedence in JavaScript

Operator Precedence in JavaScript


Operator Precedence in Python
Operator Precedence in Python

8 Likes

Thanks a lot, buddy. Sometimes I write up the entire code perfectly and get frustrated why it’s not working only to realise I had assumed an incorrect priority. Little things like these are very important!

3 Likes

Missing if-else (ternary) operator in Python table, see 6. Expressions — Python 3.11.3 documentation.

1 Like