Answers for "associative property"

C++
1

what is the associative property of an operator

Left Associative means we evaluate our expression from left to right

Right Associative means we evaluate our expression from right to left 
We know *, /, and % have same precedence, but as per associativity, answer may change:

For eg: We have expression: 4 * 8 / 2 % 5

Left associative:   (4 * 8) / 2 % 5 ==> (32 / 2) % 5 ==> 16 % 5 ==> 1

Right associative:  4 * 8 /(2 % 5) ==>  4 * ( 8 / 2) ==> 4 * 4 ==> 16
Posted by: Guest on August-25-2020

Code answers related to "associative property"

Browse Popular Code Answers by Language