Which combination of the integer variables a, b and c makes the variable m get the value 4 in the following expression ?
m = (a> b)? (a>c)? a: c):((b>c)?b:c)
Answers
Answer:
B‐E‐DM‐AS or P‐E‐DM‐AS
• B/P : Bracket or Parenthesis ( )
– In C, only ( ) used for expression
– Curly braces {}, and square bracket [] used for
some other purpose.
• Again [] may involves in expression as in the form of
array access
• E : Exponentiation Exponentiation
• DM: Division and Multiplication
• AS : Addition and Subtraction
Precedence & Associativity
( ) Evaluated Evaluated first. If nested
(embedded), innermost first.
* / % Evaluated Evaluated second. If there are
several, evaluated left to right.
+ ‐ E l td va uated thi dr . If there are
several, evaluated left to right.
= Eval d uate last, right to l f e t.
Which combination of the integer variables a, b and c makes the variable m get the value 4 in the following expression ?
Answer- a=3,b=4,c=2