C Programming - Expressions - Discussion
Discussion Forum : Expressions - General Questions (Q.No. 1)
1.
Which of the following is the correct order of evaluation for the below expression?
z = x + y * z / 4 % 2 - 1
z = x + y * z / 4 % 2 - 1
Answer: Option
Explanation:
C uses left associativity for evaluating expressions to break a tie between two operators having same precedence.
Discussion:
92 comments Page 10 of 10.
Kumar said:
2 decades ago
Hi Sivaram,
Since C uses left associativity, to break up the tie between * / in the given expression z = x + y * z / 4 % 2 - 1 chooses the * first.
Since C uses left associativity, to break up the tie between * / in the given expression z = x + y * z / 4 % 2 - 1 chooses the * first.
Sivaram said:
2 decades ago
Sir how it will b taken place as you provided that the bodmas method them first the division should be perform.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers