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
* / % + - =
= * / % + -
/ * % - + =
* % / - + =
Answer: Option
Explanation:
C uses left associativity for evaluating expressions to break a tie between two operators having same precedence.
Discussion:
92 comments Page 9 of 10.

Babatunde said:   8 years ago
a = 1; a = a++; What is the current value of a?

Abhi said:   9 years ago
Why not option c? if as the same precedence.

Thanooja said:   9 years ago
% will have more precedence than *&/ ?

Rahul said:   1 decade ago
What is associative and non-associative?

Lavanya said:   9 years ago
Thank you @Siva, I got clear answer.

Harpreet Singh said:   8 years ago
If a=48, b=13; find a+=b++*5/a++ +b.

Mohammed said:   8 years ago
The answer is 35 on mac @Shashanka.

Draj said:   8 years ago
35 is the answer 10 + 12 + 13.

Rituraj said:   1 decade ago
Yaa shashank you are right.

Rocket said:   1 decade ago
Correct answer krishna!


Post your comments here:

Your comments will be displayed after verification.