What should be passed into the if() to print the output as "Hello World"? [Note: It should execute the else block.]
if(?){
} else {
echo "World";
}
I needs to evaluate to false, and print "Hello" at the same time. printf
returns the length of outputted string upon success which is evaluated to true
when read in a Boolean context. So reversing that will evaluate to false, executing the else block.
if(!printf("Hello ")){
} else {
echo "World";
}
!printf("Hello ")
By default, printf in 'C' returns true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With