Hi! i have problem with these expressions:-
y=z=4;
x=y==z; printf(“%d,”x);
x==(y=z);printf(“%d”,x);
what is value of x in these two printf statement?
Hi! i have problem with these expressions:-
y=z=4;
x=y==z; printf(“%d,”x);
x==(y=z);printf(“%d”,x);
what is value of x in these two printf statement?
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
x=1;
x=1;
as y==z returns true value i.e 1 ,therefore this value is assigned to x ,hence x=1 in first expression,…
and in second one, value of z i.e 4 is assigned to y & x==4 returns false value therefore x returns previous value stored in it i.e 1……
why this x will return previous stored value in last statement when it is false in current statement?
y==z returns 1 which is assigned to x therefore
x=1
x==(y=z) does no effect on value of x
will u please explain
In second statement, value of z i.e 4 is assigned to y & x==4 returns false value & then x returns previous value stored in it,
This is due to exception handling & throw function in this compiler which prints previous stored value.
u can check it by removing statement x=y==z and then executing program.