answersLogoWhite

0


Best Answer

Expressions are evaluated according to the language grammar. Operator precedence and associativity are derived from the grammar in order to aid our understanding, however the order of evaluation is independent of both because the C language standard does not specify operator precedence.

The general arithmetic rules of precedence hold for most expressions such that parenthesised operations take precedence over orders followed by multiplication/division operations and finally addition/subtraction operations (as per the PODMAS acronym).

Many of the more complex expressions we encounter can generally be evaluated according to the operator precedence table, which includes the associativity, such that operations with higher precedence are bound more tightly (as if with parenthesis) than those with lower precedence.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you evaluate an expression in hierarchy of operations?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Define an expression that evaluates to true when i equals j?

In Java, or C, the expression is simply:i == jIf the two are equal, this expression will evaluate to true; if not, it will evaluate to false.In Java, or C, the expression is simply:i == jIf the two are equal, this expression will evaluate to true; if not, it will evaluate to false.In Java, or C, the expression is simply:i == jIf the two are equal, this expression will evaluate to true; if not, it will evaluate to false.In Java, or C, the expression is simply:i == jIf the two are equal, this expression will evaluate to true; if not, it will evaluate to false.


What do you mean by Hierarchy in C language?

The preference in which arithematic operations are performed in an arithematic expression is called as Hierarchy of operations.Its very important in C Programming to predefine the Hierarchy of operations to the C compiler in order to solve the given arithematic expression correctly.e.g.: If a programmer wishes to perform ,z=a+b/c;it may beinterpretedas z=(a+b)/c or z=a+(b/c).and if a=3,b=6,c=2 then using the same expression we will obtain two differentanswersas z=4.5 or z=6.To avoid this condition we must be aware of hierarchy of operations used in C programming.In arithematic expressions scanning is always done from left to right.The priority of operations is as shown below,PriorityOperatorsFirstParenthesisos brackets()SecondMultiplication & DivisionThirdAddition & SubtractionFourthAssignment i.e.=If we consider the logical operators used in C language,the operator precedence will be like;OperatorsType!Logical NOT* / %Arithmetic and moulus+ -AritmeticRelational== !=Relational&&Logical ANDLogical OR=AssignmentIn the tables above,the higher the position of an operator,higher is its priority.


How do you Evaluate the expression 32-6 plus 5x4?

46


Evaluate the expression 12?

Constant values are expressions as well, still I don't think they are so hard to evaluate... well, in this case it is twelve


When you need to satisfy two or more criteria to initiate an event in a program you must make sure that the second decision is made entirely independently of the first decision?

Evaluate the criteria before executing the conditional expression. In pseudocode:result1 = evaluate( criteria1 );result2 = evaluate( criteria2 );if( result1 && result2 ) initiate_event;Note that this is not the same as the following:if( evaluate( criteria1 ) && evaluate( criteria2 )) initiate_event;If the evaluation of criteria1 fails for any reason, then the whole expression fails and criteria2 is never evaluated. so if the evaluations must be done independently of each other, then they must be done prior to the conditional expression, storing the results for use in the conditional expression.

Related questions

When you replace the variable with a number and perform the operations you blank an expression?

evaluate.


How can you evaluate a expression?

replace the variables with the given values and simplify using the order of operations.


How do you evaluate an expression when given values for the variables?

You replace each variable by its value. Then you do the indicated calculations.


What does it mean to evaluate each expression when there is an exponent?

To evaluate an expression means to find its numerical value. A power consists of a base and an exponent. According to the order of operations, operations inside parentheses (or other grouping symbols) are performed first, followed by the evaluation of powers ... then (*/) and (+-).


How do you evaluate an expression with more than two operation symbol without exponent and parenthesis?

In Evaluating Expression first,replace each letter in the expression with the assigned value. second,perform the operations in the expression using the correct order of operations and the last you got the answer


Define an expression that evaluates to true when i equals j?

In Java, or C, the expression is simply:i == jIf the two are equal, this expression will evaluate to true; if not, it will evaluate to false.In Java, or C, the expression is simply:i == jIf the two are equal, this expression will evaluate to true; if not, it will evaluate to false.In Java, or C, the expression is simply:i == jIf the two are equal, this expression will evaluate to true; if not, it will evaluate to false.In Java, or C, the expression is simply:i == jIf the two are equal, this expression will evaluate to true; if not, it will evaluate to false.


What is the numerical expression for 6 added to the quatient of 42 and 21?

The expression for this type of problem is 6 + (42 / 21). Then, evaluate that by the order of operations to obtain: 6 + 2 = 8


Evaluate an expression?

Find the value of the expression.


Evaluate the expression 17P2?

To "evaluate" an expression, you need to know the value for the variables.


Evaluate the expression for a 4 and b 3.?

Unfortunately there is no expression to evaluate!


What is the meaning of evaluate in maths?

In mathematics, to evaluate means to find the numerical value of an expression or equation. This often involves substituting given values for variables and simplifying the expression using mathematical operations such as addition, subtraction, multiplication, and division. Evaluation is a fundamental process in mathematics that allows us to determine the specific numerical result of a mathematical statement.


Explain how to write and evaluate an algebraic expression.thirteen less than the quotient of forty and a number; evaluate when n = 2?

Sample Response: Replace keywords with variables, numbers, and operations. Less than is subtraction, and the quotient is division. Order matters with subtraction and division. The expression is 40 n -13. To evaluate is the expression, substitute 2 in for the variable, and then use order of operations to simplify. The value when n = 2 is 7.