Monday, July 30, 2012

Adapting to the compiler

An acquaintance posted a fun little snippet of C code that prints 1 - 1000 and then exits.


Looked like fun, so I came up with my own:


You can even compile and run this code right now at codepad. Modern web apps are truly amazing (see jsLinux and Game Boy emulation).

Reader: what does d refer to? Will it change depending on the compiler/architecture? There might be a difference between char *s="foo"; and char s[]="foo"; ...