S
santosh
Karl said:There's an error here:
3 . Its given that variable x has been assigned a value of 5, which
of the following statement will output the message "I am quite right"
o if (x!=5) printf("I am quite right");
o if (x=5) printf("I am quite right");
o both statements will display the message
o none of the above
You say "none of the above" is the correct answer; but actually "if
(x=5) printf("I am quite right");" is the correct answer.
Yes, but I suspect the question itself is misleading. I think the OP
meant to write an equality comparison in the second if, not an
assignment.
Or it may be that he, (the OP), _did_ mean an assignment to illustrate
that in C an assignment expression evaluates to the value of the LHS
after the assignment.