/
Precedence and Associativity Precedence and Associativity

Precedence and Associativity - PowerPoint Presentation

mitsue-stanley
mitsue-stanley . @mitsue-stanley
Follow
461 views
Uploaded On 2016-09-10

Precedence and Associativity - PPT Presentation

Precedence Precedence means how an expression like xRySz Should be evaluated here R and S are different operators If R has the higher precedence than S it will be evaluated as xRy Sz while if S has the higher precedence than R it will be treated as xR ID: 463505

precedence left associativity amp left precedence amp associativity evaluated higher means expression operators xry

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Precedence and Associativity" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Precedence and Associativity

Precedence:-

Precedence means how an expression like xRySz

Should be evaluated ,here R and S are different operators. If R has the higher precedence than S, it will be evaluated as (xRy)

Sz

, while if S has the higher precedence than R it will be treated as xR(

ySz

) Slide2

.

Associativity:-

Associativity means if an expression like

xRyRz

(where R is a operator such as + or <= ) should be evaluated “left to right”

i.e

(

xRy

)

Rz

or right to left

i.e

xR

(

yRz

)Slide3

.

Operators

in order of precedence

Associativity

(),[]

Left to Right

!,~,++,-(unary),*(indirection),&(address of),size of

Right to Left

*,/,%

Left to Right

<<,>>

Left to Right

<,<=,>=,>

Left to Right

==,!=

Left to Right

&(bitwise AND)

Left to Right

^

Left

to Right

|

Left to Right

&&

Left to Right

||

Left to Right

? :

Right to Left

=,+=,-= etc

Right

to Left

,

Left to Right