Alex Rivera | Logout

What is associativity of operators and why is it important?

Asked 2009-05-30T20:08:07.783
106

What is associativity for an operator and why is it important?

Edit
Report

2 Answers

15

There are three kinds of associativity:

The Associative property in mathematics

Order of Operations in programming languages

Associativity in CPU caches.

The Associative property in mathematics is a property of operators such as addition (+). This property allows you to rearrange parentheses without changing the value of a statement, i.e.:

(a + b) + c = a + (b + c)

In programming languages, the associativity (or fixity) of an operator is a property that determines how operators of the same precedence are grouped in the absence of parentheses; i.e. in what order each operator is evaluated. This can differ between programming languages.

In CPU caches, associativity is a method of optimizing performance.

answered 2009-05-30T20:13:16.650
1

We all know that precedence is important but so is associativity in interpreting the meaning of an expression. For a really simple intro try Power of Operators.

answered 2010-03-22T10:12:49.260

Your Answer