Often times we use arithmetic operations, relational operators, logical operators and assignment operators together in a instruction / statement. We must know the precedence / priority of the operator so that we can write proper code.
Related Read:
Basic Arithmetic Operations In C
Relational Operators In C
Logical Operators In C
Priority | Operator | Type |
---|---|---|
1 | ! | Logical NOT Operator |
2 | * / % | Arithmetic Operator |
3 | + – | Arithmetic Operator |
4 | < > <= >= | Relational Operator |
5 | == != | Relational Operator |
6 | && | Logical AND Operator |
7 | || | Logical OR Operator |
8 | = | Assignment Operator |
Note: Write down above table of operator priority on a piece of paper and have it handy while writing the code. You’ll get used to it after some time – until then, keep revisiting the hierarchy of operators.
Operator Precedence / Priority / Hierarchy: C
For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List
For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert