# Operator Precedence - Table

**URL:** <https://discuss.codechef.com/t/operator-precedence-table/14545>\
**Category:** tutorial\
**Tags:** c, c-plus-plus, java, javascript, precedence, python, tutorial\
**Created:** [May 1, 2017, 11:26pm UTC](https://discuss.codechef.com/t/operator-precedence-table/14545 "2017-05-01T23:26:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kay\_kay](https://discuss.codechef.com/user_avatar/discuss.codechef.com/kay_kay/32/297822_2.png) [@kay\_kay](https://discuss.codechef.com/u/kay_kay)\
**Post date:** [May 1, 2017, 11:26pm UTC](https://discuss.codechef.com/t/operator-precedence-table/14545/1 "2017-05-01T23:26:02Z")

</div>

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](https://discuss.codechef.com/upfiles/C.PNG)

* * *

**Operator Precedence in C++**

![Operator Precedence in C++](https://discuss.codechef.com/upfiles/CPP.PNG)

* * *

**Operator Precedence in Java**

![Operator Precedence in Java](https://discuss.codechef.com/upfiles/Java.PNG)

* * *

**Operator Precedence in JavaScript**

![Operator Precedence in JavaScript](https://discuss.codechef.com/upfiles/JavaScript.PNG)

* * *

**Operator Precedence in Python**  
 ![Operator Precedence in Python](https://discuss.codechef.com/upfiles/Python.PNG)

---

<div class="post-metadata">

**Author:** ![abdullah768](https://discuss.codechef.com/user_avatar/discuss.codechef.com/abdullah768/32/11498_2.png) [@abdullah768](https://discuss.codechef.com/u/abdullah768)\
**Post date:** [May 2, 2017, 12:01am UTC](https://discuss.codechef.com/t/operator-precedence-table/14545/2 "2017-05-02T00:01:20Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![hginzel](https://discuss.codechef.com/user_avatar/discuss.codechef.com/hginzel/32/28624_2.png) [@hginzel](https://discuss.codechef.com/u/hginzel)\
**Post date:** [March 5, 2021, 2:49pm UTC](https://discuss.codechef.com/t/operator-precedence-table/14545/3 "2021-03-05T14:49:54Z")

</div>

Missing if-else (ternary) operator in Python table, see [6. Expressions — Python 3.11.3 documentation](https://docs.python.org/3/reference/expressions.html#operator-precedence).
