David Korn's winning entry
main() { printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}
Several points are important to understand in this program:
-
What is the symbol `unix' and what is its value in the program?
Clearly `unix' is not a function, and since `unix' is not declared
to be a data type (such as int, char, struct foo, enum, ...)
what must `unix' be?
- What is the value of the symbol "have"? (hint: the value is
NOT 4 characters, or 'h', or a string) Consider the fact that:
char *x;
defines a pointer to a character (i.e. an address), and that
the `=' assigns things is compatible types. Since:
x = "have";
is legal C, what type of value is "have"?
- Note that the following expressions yield the same value:
x[3] *(x+3) *(3+x)
since addition is communitive. What can be said about the value:
3[x]?