A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-66.cpp
1#include<iostream>
2intmain(){
3if("hello")
4std::cout<<"truthy\n";
5else
6std::cout<<"falsy\n";
7return0;
8}
Conversions
Answer & explanation
Console output
truthy
Why
A string literal in boolean context decays to a pointer to its first character, and that pointer is never null. The pointer-to-bool conversion therefore yields true, so the if branch runs and prints truthy. The contents of the string are irrelevant to the condition.