mini-ode to "hello, world"

“FORTRAN begat ALGOL, which begat CPL, which begat BCPL, from whence B, and then C, arose…”

I hadn’t looked at Scala in a while, so I head over to and start looking through docs. First the tutorial, and sure enough the first thing they do is show a Hello, World example. It suddenly struck me that we may be at a point where a lot of people don’t know or even remember where this started.

The first time I was exposed to “hello, world” was, appropriately enough, in the first widely published book that included it – Kernigan & Ritchie’s “The C Programming Language.” It was 1994, and until that time I had mostly dabbled with Pascal (Turbo Pascal FTW!) and minor languages like the programming language for dBase. The pre-ANSI C version of “hello, world” simply read:

main() { printf("hello, world\n"); }

(the ANSI C edition I think added the obligatory #include <stdio.h> at the beginning).

This much I remembered, but was that the first use? It seemed likely…

According to the wikipedia entry on the topic, it turns out that’s not the first time “hello, world” was used as the primordial program for a language – Kernigan had used it earlier in his Tutorial Introduction to the Language B, as follows:

main( ) { extrn a, b, c; putchar(a); putchar(b); putchar(c); putchar('!*n'); } a 'hell'; b 'o, w'; c 'orld';

It is fitting that C’s version was significantly simpler and clearer. :-)

It’s also interesting that to this day I still see “The C Programming Language” as the best book ever written to teach a language, or as an introduction to programming for that matter. The only one that comes to mind that could match it in terms of how perfectly the book “wraps around” its topic as well as being readable is, perhaps, “The TeXbook” (in which programming concepts play an important but not overriding role).

Good times.

ps: somewhat related – a story I heard many years ago about why C++ was called that –after starting as “C with Classes”– was that when the time came to name the successor to C, they couldn’t decide whether to call it “D” (since it would follow B and C) or “P” (since it would follow C in “BCPL”). Faced with this conundrum, the solomonic answer was to call it “C++” by just adding the increment operator to “C”. Apocryphal, you say? May be so! But for fiction, it’s good fiction. :-)