This exercise is a brain teaser where I introduce you to one of the most famous hacks in C called Duff’s device, named after Tom Duff, its inventor. This little slice of awesome (evil?) has nearly everything you’ve been learning wrapped in one tiny, little package. Figuring out how it works is also a good, fun puzzle.
Part of the fun of C is that you can come up with crazy hacks like this, but this is also what makes C annoying to use. It’s good to learn about these tricks because it gives you a deeper understanding of the language and your computer. But you should never use this. Always strive for easy-to-read code.
Discovered by Tom Duff, Duff’s device is a trick with the C compiler that actually shouldn’t ...