0 like 0 dislike
28 views
in Computer Science by (1.0m points)
What is meant by operator precedence? Draw a table for precedence level of operators.

1 Answer

0 like 0 dislike
by (1.0m points)
Precedence of an operator can be compared to as a rank. If different operators are given in an expression,

 for eg:  a+b*c;

 Here + and * are the operators. By looking the precedence of the operator, the compiler will decide which operator will execute first. Here * operator has highest precedence than + operator. So * operator will be executed first and after that operator + will be ececuted. This is known as the precedence of an operator

Associativity means that when the same operator appears in a row, then to which direction the evaluation binds to.

for eg: let A be an operator and aAbAc be the expression .

 if A is left assocoative, then it evaluates as,

(aAb)Ac . That means aAb will be evaluated first and then the result will be evaluates with c.

if A is right associative, then it evaluates as,

aA(bAc). That means bAc will be evaluated first and then the result will be evaluated with a

This is known as the associativity of operator.

Related questions

0 like 0 dislike
1 answer 38 views
0 like 0 dislike
1 answer 40 views
0 like 0 dislike
1 answer 103 views
0 like 0 dislike
1 answer 22 views
0 like 0 dislike
1 answer 45 views
asked Feb 13, 2019 in Computer Science by danish (1.0m points)
0 like 0 dislike
1 answer 48 views
asked Feb 13, 2019 in Computer Science by danish (1.0m points)
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers

8.7k comments

3.3k users

Free Hit Counters
...