6. What's the "condition" so that the following code snippet prints both HelloWorld !
if "condition"
printf ("Hello");
else
printf("World");
Answer: “condition” can replaced by !printf(“Hello”);
or printf(“Hello”)&&0
or printf(“Hello”), 0
Any expression with commas will take the final value as the expression value.
7. main(){
int i=5;
printf(“%d”,i++ * i++);
i = 5;
printf(“%d”,++i * i++);
i = 5;
printf(“%d”,i++ * ++i);
i=5;
printf(“%d”,++i * ++i);
}
Ouput: 25 36 36 49
When a variable is modified more than once in an expression it takes same value(infact final value) for all the uses or that variable.
Custom Search
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment