Here's an example:-
Code: Select all
//Absolutely fails for non-numbers.
int stringToInt(char *c)
{
int ret = *c - '0';
while (*++c && ((ret = (ret * 10) + (*c - '0')) || true));
return ret;
}Code: Select all
//Absolutely fails for non-numbers.
int stringToInt(char *c)
{
int ret = *c - '0';
while (*++c && ((ret = (ret * 10) + (*c - '0')) || true));
return ret;
}
Of course. I actually downloaded 'em all, and built them and modified a few. Fun stuff there. Did you see the flight simulator?syedhs wrote:Google for 'obfuscated c'.. and one example is this: (although a little too extreme):-![]()
http://www.ioccc.org/2004/anonymous.c
or this:
http://www.ioccc.org/2004/burley.c
The latter link do a one statement C expression separated by comma.