Extra Credit 2

Due: May 27, 2024
Points: 35


C can be a cryptic language. The International Obfuscated C Code Contest pokes fun at this. Entries are to be C programs that are as cryptic, obscure, and difficult to read as possible; but they must compile successfully (usually with warnings!) and do something.

The judges ruled that David Korn’s entry from the 4th International Obfuscated C Code Contest was the best one-line entry ever received up to then. Here it is:


main() { printf(&1["\021%six\12\0"],(1)["have"]+"fun"-0x60);}
You can also get the source code here.

Please simplify each argument of the printf. You need to explain why the program does what it does.

Note: If you compile this program on the CSIF, you will get numerous warnings. You do not need to fix them (in fact, you should not) or explain them.

Submit your answers in Gradescope using the template in the assignment on Gradescope; it is also attached to the PDF of this assignment.. If you need to print it out and write your answers on it, please scan it in to Gradescope. If you cannot scan it in, please give it to me and I will do so.

You can download the template by clicking here or on the link ``You can also obtain a PDF version of this.'' at the bottom of the page. Here is what the template contains:


Extra Credit 2 Answer Template

Name:___________________ Student ID:___________________

Simplify the first argument in the printf. Explain in detail your analysis.

Simplify the second argument in the printf. Explain in detail your analysis.

What does the printf print, and why?


UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: [email protected]
ECS 36A, Programming & Problem Solving
Version of May 17, 2024 at 3:02PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh