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 5 of 10.
Chris said:
8 years ago
According to me, it is;
int main().
int a=5
Int b=++a*a++
Print(%d,b)
int main().
int a=5
Int b=++a*a++
Print(%d,b)
Rajoo said:
8 years ago
Anybody, explain me the answer of this question. please.
Rakesh kumar said:
8 years ago
@Jaya.
a=4;
Printf("...d",a=a++)
Ans- here a++ is in post increment that's why it will change its value in next step but here there is no any next step that's what it will print the original value of a which is 4.
And in Printf(",,...d",a).
There is no any condition for value change so it will print its real value which is 4.
That's why both answers will be 4
a=4;
Printf("...d",a=a++)
Ans- here a++ is in post increment that's why it will change its value in next step but here there is no any next step that's what it will print the original value of a which is 4.
And in Printf(",,...d",a).
There is no any condition for value change so it will print its real value which is 4.
That's why both answers will be 4
Jay Mehta said:
8 years ago
#include<stdio.h>
int main()
{
int a=5;
int b=++a*a++;
printf("%d",b);
return 0;
}
Can anyone tell me the answer of this?
int main()
{
int a=5;
int b=++a*a++;
printf("%d",b);
return 0;
}
Can anyone tell me the answer of this?
Garima said:
8 years ago
% /*+-= is hierchie.
Jaya said:
8 years ago
a=4;
printf("%d",a=a++);
printf("%d",a);
Why the output is always 4? Can anyone explain me?
printf("%d",a=a++);
printf("%d",a);
Why the output is always 4? Can anyone explain me?
YOUNI said:
8 years ago
What will be the value of sum after the following nested for loops are executed?
for i < 5
Please tell me the answer.
for i < 5
Please tell me the answer.
Draj said:
8 years ago
35 is the answer 10 + 12 + 13.
Mohammed said:
8 years ago
The answer is 35 on mac @Shashanka.
Ahmed said:
9 years ago
Can anyone solve this?
What is the output of the following?
a=23
b=34
puts a&b
puts a|b
puts a^b
puts ~a
What is the output of the following?
a=23
b=34
puts a&b
puts a|b
puts a^b
puts ~a
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers