logoalt Hacker News

sangeeth96yesterday at 7:12 PM1 replyview on HN

I had to fight through school and university in India with my teachers who believed these were legit questions to ask in written exams. Can't 100% blame them since almost all standard-issue textbooks had them and claimed they'd give predictable output. I thought the same until I noticed the weirdness when running them across different compilers and after I read about UB, sequence points and similar quirks in books that are not total garbage.

Luckily, I ended up with smug smiles in all those cases after showing them the output from different compilers.


Replies

afdbcreidtoday at 12:49 AM

But what answer did they expect? A specific number or that it's UB?