An Obfuscated English-to-Pig-Latin Converter

PIG_LATIN, a C program which converts an input file of English text into a file of "Pig Latin" text, using a very obscure programming style, by Don Dodson.

The program was the winner, in the "Most Humorous" category, of the annual International Obfuscated C Code Contest (IOCCC) - a contest you only want to win on purpose!

To see why it was a winner, print out the code. Look at it. Look at it a long time. Realize that the C compiler sees nothing wrong with this code, and can compile it into a program that really does what it says it will do.

As the author says:

"Istha ogrampra akesta Englishwa extta aswa inputwa andwa anslatestra itwa intowa Igpa Atinla."

The obfuscation is on several levels.

Most obviously, the shape of the program.

Underneath that, the variable names are in Pig Latin, as are the names of the standard C functions, such as >putchar. Even main is written as ainma.

The program construction is also very obfuscated, with all of the code being inside the parentheses of one of the 6 orfa loops.


        pig_latin < input > output
will read the text of input, convert it to Pig Latin, and write the converted text to output.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


PIG_LATIN is available in a C version.

Related Data and Programs:

CAESAR, a C library which can apply a Caesar Shift Cipher to a string of text.

MANDELBROT_ASCII, a C program which generates an ASCII image of the Mandelbrot fractal set using just two lines of C.

mgs, a C library which is an example of obscure legacy code, which the student is encouraged to study, understand, and document. This example is due to Diane O'Leary.


ROT13, a C program which reads a file of text and converts it to ROT13 text, and vice versa.

UUDECODE, a C program which reads a UU encoded text file and translates it back to its original form.

UUENCODE, a C program which translates a file (possibly in binary format) to the UU encoding.


Don Dodson


Ebsterway's Ictionaryday

Source Code:

Last revised on 24 July 2019.