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 7 of 10.

Shivani garg said:   1 decade ago
I m still confused in dis expression
int b,a=10;
b=a++ + ++a;
printf("%d %d %d %d",b,a++,a,++a);

Nilay tagde said:   8 years ago
When this *for*loop will terminate?
for(a=1;scanf("%d",&a);a++)
printf("%d",a);

Prakash said:   1 decade ago
Hi guys. I have doubt on gcc compiler. How many programming languages can compiled by gcc compiler.

Shashanka said:   1 decade ago
What is the output of this.

B=a++ + ++a + ++a if a=10.

I got b=36.

But how please explain.

Akhila said:   1 decade ago
Explain this question? According to BODMAS it is wrong so please do explain me?

Pravu said:   1 decade ago
Hi shasankha, u've used 3 integers to be printed. So output will be 22 13 14.

Latha said:   5 years ago
How left associativity is calculated, I didn't understand? Please explain.
(1)

Chris said:   8 years ago
According to me, it is;

int main().
int a=5
Int b=++a*a++
Print(%d,b)

Jahnavi said:   6 years ago
In don't understand the answer can anyone please explain it clearly?

Kshitiya dahale said:   1 decade ago
Depends on printf execution either left to right or right to left.


Post your comments here:

Your comments will be displayed after verification.