IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

1990/pjr - Most Unusual Data Structure

← jaw ↑ 1990 ↑ scjones → C code Makefile Inventory





Author:

To build:

make all

There is an alternate version that does something different that can be used if your compiler is incapable of compiling X=g()... in main(). It can be used for another purpose too.

To use:

./pjr

Alternate code:

Note that some compilers will be unable to compile the expression X=g()... in main() due to lack of temporary stack space. One might want to try replacing main() with:

main(){X=s().v().o().o().l().S().d().l().i().o().w().N();}

if this is a problem, which is what this alternate code is.

NOTE: it prints something else and it is what the author suggested one try as well.

Alternate build:

make alt

Alternate use:

./pjr.alt

Judges’ remarks:

This program prints out a string. Can you figure out how it is done?

By use of pointers to functions returning a struct of pointers to functions!

Spoiler:

This program prints out the string:

the quick brown fox jumped over the lazy dog

Author’s remarks:

It is simple to make the program print other strings. Each alphabetical character from a to z is printed out as its opposite:

a->z b->y c->x etc

To encode a new string input the string as it is meant to come out:

X=s().v().o().o().l().S().d().l().i().o().w().N();

Note: S() represents a space and N() a newline. This will now produce…

hello world

By the way, there is actually a piece of code which is not used in the original program! I leave it as an intellectual exercise to the reader to find out what it is.

Inventory for 1990/pjr

Jump to top

Primary files

Secondary files