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 6 of 10.
Ambrisha srivastava said:
7 years ago
Here;
int a=14,b;
b=(++a)+(a++)+(--a);
Give the value of a,b;
I got the outpu 45, other PC 42 .
Please explain to me.
int a=14,b;
b=(++a)+(a++)+(--a);
Give the value of a,b;
I got the outpu 45, other PC 42 .
Please explain to me.
Kumar said:
9 years ago
What is the value of b if a=2;
main()
{
int a=2,b;
b=++a*++a;
printf("b=%d",b);
}
Can explain this solution.
main()
{
int a=2,b;
b=++a*++a;
printf("b=%d",b);
}
Can explain this solution.
LightYagami said:
8 years ago
Can anyone explain me the question?
main()
{
int a=1,b=2,c=3;
printf("%d",a+=(a+=3,5,a));
}
Answer is 8.
main()
{
int a=1,b=2,c=3;
printf("%d",a+=(a+=3,5,a));
}
Answer is 8.
Tillu said:
7 years ago
@Team Bi.
int a=2,b=3,c;
a=(b++)+(++b)+a;
c=a>b?a:b;
b=(a++)+(b--)+a;
c=c++*b--
The value of a=11, b=25, c=260.
int a=2,b=3,c;
a=(b++)+(++b)+a;
c=a>b?a:b;
b=(a++)+(b--)+a;
c=c++*b--
The value of a=11, b=25, c=260.
TEDD said:
2 months ago
BODMAS meaning.
B = BRACKETS
O = ORDERS/ EXPONENTIAL
D = DIVISION
M = MULTIPLICATION
A = ADDITIONS
S = SUBTRACTION
B = BRACKETS
O = ORDERS/ EXPONENTIAL
D = DIVISION
M = MULTIPLICATION
A = ADDITIONS
S = SUBTRACTION
Atul said:
1 decade ago
int i=5;
do
{
putchar(i+100);
printf("%d",i--);
}
while(i);
// What is the output & explain please.
do
{
putchar(i+100);
printf("%d",i--);
}
while(i);
// What is the output & explain please.
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?
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.
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
Team BI said:
8 years ago
int a=2,b=3,c;
a=(b++)+(++b)+a;
c=a>b?a:b;
b=(a++)+(b--)+a;
c=c++*b--
Find the final values of a, b and c.
a=(b++)+(++b)+a;
c=a>b?a:b;
b=(a++)+(b--)+a;
c=c++*b--
Find the final values of a, b and c.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers