views:

983

answers:

5

'Hello world' is the usually the first example for any programming language. I've always wondered where this sentence came from, where was it first used.

I've once been told that it was the first sentence ever to be displayed on a computer screen. but I've not been able to find any reference to this.

So my question is:
Where does the practice to use 'hello world' as the first example for computer languages originate from?
Where was it first used?

Update
Although the answers are quite interesting, I should have noted that I had read the wikipedia article. It does answer the question about the first use in literature, but does not answer when 'hello world' was first used.
So I think that it is save to conclude that it was not the first ever sentence to be displayed on a computer screen and that there is no record about when it was first used?

+7  A: 

The first C program in the book "The C Programming Language" was to print "hello world!" on the screen.

Since then it is used as the first program to introduce the basic details of a programming language.

Xolve
+25  A: 

According to wikipedia:

While small test programs existed since the development of programmable computers, the tradition of using the phrase "Hello world!" as a test message was influenced by an example program in the seminal book The C Programming Language. The example program from that book prints "hello, world" (without capital letters or exclamation mark), and was inherited from a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version:

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

The first known instance of the usage of the words "hello" and "world" together in computer literature occurred earlier, in Kernighan's 1972 Tutorial Introduction to the Language B[1], with the following code:

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

First time I came across it in print was (I think) the first edition of K&R, so tha would have been circa 1982, but I'd been writing my own "Hello world" programs long before that, as had everyone else.

anon
A: 

From Wikipedia

While small test programs existed since the development of programmable computers, the tradition of using the phrase "Hello world!" as a test message was influenced by an example program in the seminal book The C Programming Language. The example program from that book prints "hello, world" (without capital letters or exclamation mark), and was inherited from a 1974 Bell Laboratories internal memorandum by Brian Kernighan, Programming in C: A Tutorial, which contains the first known version:

http://en.wikipedia.org/wiki/Hello_world_program

Tuoski
+6  A: 

From http://en.wikipedia.org/wiki/Hello_world_program:

The first known instance of the usage of the words "hello" and "world" together in computer literature occurred earlier, in Kernighan's 1972 Tutorial Introduction to the Language B[1], with the following code:

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