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.
Ravi Kumar said:
7 years ago
Hi @Sakib,
According to me, when you did not assign any value to a variable then it will print 0.
So, in this program, it will give output (0).
According to me, when you did not assign any value to a variable then it will print 0.
So, in this program, it will give output (0).
Medss said:
7 years ago
Int a=1 ,b=2,c=3
Switch (p)
{
Case1:a++
Case2:++b
Break;
Case 3:c--;
}
System.out.println(a+","+b+","+c);
When 1:p=1 2:p=3.
Switch (p)
{
Case1:a++
Case2:++b
Break;
Case 3:c--;
}
System.out.println(a+","+b+","+c);
When 1:p=1 2:p=3.
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?
Sharmin ferdoush said:
7 years ago
#include<stdio.h>
main()
{
int x=5,y=6;
x=++y;
y++=x--;
x++=6+(++y);
printf("%d%d\n",x++,y);
}
Anyone explain it, please.
main()
{
int x=5,y=6;
x=++y;
y++=x--;
x++=6+(++y);
printf("%d%d\n",x++,y);
}
Anyone explain it, please.
Kiran said:
1 decade ago
int a=10;
int b;
b=a++ + ++a + ++a;
printf("%d %d %d %d %d %d",b,a++,a,++a,a--,++a);
OUTPUT:
34 14 15 15 14 15
Please explain?
int b;
b=a++ + ++a + ++a;
printf("%d %d %d %d %d %d",b,a++,a,++a,a--,++a);
OUTPUT:
34 14 15 15 14 15
Please explain?
Raji said:
9 years ago
{
int i=3,j=2,k=0,m;
m=++i || ++j && ++k
printf("%d %d %d %d",i,j,k,m);
}
Can anyone explain this solution, please?
int i=3,j=2,k=0,m;
m=++i || ++j && ++k
printf("%d %d %d %d",i,j,k,m);
}
Can anyone explain this solution, please?
Mithra said:
7 years ago
Hi,
int a=10.
Then pre-decrement perform.
We got --a=9.
Then post increment perform.
We got ++a=11.
Then add two value b=9+11.
int a=10.
Then pre-decrement perform.
We got --a=9.
Then post increment perform.
We got ++a=11.
Then add two value b=9+11.
Mukesh said:
1 decade ago
@atul
putchar() will print char which is equal to ascii value 5+100=105 ie i..then printf will the value of i and so on.
putchar() will print char which is equal to ascii value 5+100=105 ie i..then printf will the value of i and so on.
Sorna said:
8 years ago
@ALL.
#include<stdio.h>
int main()
{
int a=5;
int b=++a*a++;
printf("%d",b);
return 0;
}
Answer is 36.
#include<stdio.h>
int main()
{
int a=5;
int b=++a*a++;
printf("%d",b);
return 0;
}
Answer is 36.
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.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers