Thanks to “Ok, panico”, who discovered this gem and has shared it with all his readers


A beautiful discover, directly from the Internet Archive, free and nicely legal: the first edition (dated 1978) of “The C Programming Language”, the bible the C language, written directly by those created this loved/hated language (Dennis Ritchie and Brian Kernighan).



Thanks to “Ok, panico”, who discovered this gem and has shared it with all his readers:

Non è come quello a stampa, manca la copertina, ma sembra tutto OK

(It is not like that in the press, missing the cover, but it all seems OK)

And now, the classic ‘Hello world’ (page 13 of PDF):

The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages:

Print the words
 hello, world

This is the basic hurdle; to leap over it you have to be able to create the program text somewhere, compile it successfully, load it, run it, and find out where your output went. With these mechanical details mastered, everything else is comparatively easy.

In C, the program to print “hello, world” is

main()
 {
 printf("heIlo, worldn");
 }

Just how to run this program depends on the system you are using. As a specific example, on the UNIX operating system you must create the source program in a file whose name ends in “.c“, such as hello.c, then compile it with the command

cc hello.c

If you haven’t botched anything, such as omitting a character or misspelling something, the compilation will proceed silently, and make an executable file calleda.out. Running that by the command

a.out

will produce

hello, world

as its output. On other systems, the rules will be different; check with local expert.