EmbLogic's Blog

Order of Precedence

Operators of the same priority are evaluated from left to right, so that Operators of the same priority are evaluated from left to right, so that

a – b – c

is evaluated as

( a – b ) – c  ????????????????????/

3 Responses to Order of Precedence

  1. kamran ali says:

    In the case of same operator existing in the mathematical equation in C.
    The complier will start to compile for left to right ( for your case).
    and the complier will take it as
    (a-b)-c;

    To elaborate it more, in some case, different operator of same priority can exist in same equation.
    ex: a=3/2*5;
    Here / and * have same priority, so it is up to the complier to evaluate / first and * second and vica versa is also true.

    So to overcome such a problem use brackets.
    ex:
    a=(3/2)*5; output : 5
    a=3/(2*5); output : 0

  2. m.siddarth says:

    Could you elaborate the question? So that it would help us to solve us more precisely.

  3. sir actually he want assurance of his observation

Leave a Reply to m.siddarth Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>