 0

# What do you mean by Hierarchy in C language?

The preference in which arithematic operations are performed in an arithematic expression is called as Hierarchy of operations.

Its very important in C Programming to predefine the Hierarchy of operations to the C compiler in order to solve the given arithematic expression correctly.

e.g.: If a programmer wishes to perform ,z=a+b/c;it may beinterpretedas z=(a+b)/c or z=a+(b/c).

and if a=3,b=6,c=2 then using the same expression we will obtain two differentanswersas z=4.5 or z=6.

To avoid this condition we must be aware of hierarchy of operations used in C programming.

In arithematic expressions scanning is always done from left to right.

The priority of operations is as shown below,

Priority

Operators

First

Parenthesisos brackets()

Second

Multiplication & Division

Third

Fourth

Assignment i.e.=

If we consider the logical operators used in C language,the operator precedence will be like;

Operators

Type

!

Logical NOT

* / %

Arithmetic and moulus

+ -

Aritmetic

Relational

== !=

Relational

&&

Logical AND

Logical OR

=

Assignment

In the tables above,the higher the position of an operator,higher is its priority.

🙏
0
🤨
0
😮
0
Study guides

2 cards

➡️
See all cards

1 card

➡️
See all cards