#include<stdio.h>
int main()
{
int x=2,y,z;
x*=3+2;
printf(“%d\n”,x);
x*=y=z=4;
printf(“%d\n”,x);
x=y==z;
printf(“%d\n”,x);
return 0;
}
#include<stdio.h>
int main()
{
int x=2,y,z;
x*=3+2;
printf(“%d\n”,x);
x*=y=z=4;
printf(“%d\n”,x);
x=y==z;
printf(“%d\n”,x);
return 0;
}
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
As the statement
x=y=z; implies that the value in z has to be assign to y and x simultaneously. Hence, the value in x is 4 and correspondingly the printf statement will print 4.
and what if i do x=y==z; then
first y==z will be evaluated. here both y and z are equal to 4.
so it will return 1.
and x will be printed 1.