Puzzle 25 | Weakly Typed, Strongly Puzzling |
| #include <iostream> |
| |
| int main() |
| { |
| std::cout << +!!""; |
| } |
Guess the Output | |
---|---|
Try to guess what the output is before moving to the next page. |
The program displays the following output:
| 1 |
Discussion
Wait, what? Is this legal C++? What does it even mean, and why does it print 1?
While C++ is a statically typed language, it’s not particularly strongly typed. As we’ve ...
Get C++ Brain Teasers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.