I don't remember where I read this, but it's in C, and here's the deal:
  1. Create a file called void main(){puts("Hello, World!");}, assuming your filesystem will allow it.
  2. Its contents should be:

        __FILE__

  3. Compile it with -istdio.h
Quite clever. Although gcc won't let you compile it without a file extension.

Update I was talking this over with Bozyo the other day. We decided that you can do it like this: on the command line:

gcc -Df=__FILE__ -Dc=// -istdio.h void*.c, then add a "c .c" to the filename and change the content to "f".
There is only one way to make a Hello World program shorter than that.

Add -DA=__FILE__ to the gcc args, and change the source file's contents to just A.

That's the shortest Hello World program possible, as it's just one byte in size.

Log in or registerto write something here or to contact authors.