Hello World: Difference between revisions
imported>Johan Förberg (After a week, still no '99 bottles of beer' article; now it's going.) |
imported>Ro Thorpe m (presumably - if, like me, you'd never heard of it...) |
||
Line 1: | Line 1: | ||
{{subpages}} | {{subpages}} | ||
A '''Hello World''' program, as first introduced in the book ''The C Programming Language'', is a very short program that typically just prints a word or two of output to a console. Such a program is often one of the first programs that a [[programmer]] writes when learning a [[programming language]], as it provide's a cursory introduction to the language's [[syntax]] and output. | A '''Hello World''' computer program, as first introduced in the book ''The C Programming Language'', is a very short program that typically just prints a word or two of output to a console. Such a program is often one of the first programs that a [[programmer]] writes when learning a [[programming language]], as it provide's a cursory introduction to the language's [[syntax]] and output. | ||
== Hello World as a first program == | == Hello World as a first program == |
Revision as of 19:44, 26 July 2010
A Hello World computer program, as first introduced in the book The C Programming Language, is a very short program that typically just prints a word or two of output to a console. Such a program is often one of the first programs that a programmer writes when learning a programming language, as it provide's a cursory introduction to the language's syntax and output.
Hello World as a first program
In teaching a new language, there arises a need for a minimal, 'first phrase' to introduce students to the new language. In natural language, this is often "Hello, my name is John" or a variation thereof. The equivalent in computing is the program which says, prints, or displays "Hello, World!" or something else to that effect. Such programs, regardless of the actual wording, are called "Hello World" programs. The program is not meant to display the features or design of a language, since printing simple strings is seldom the main focus of a lanugage. Instead, the example aims to give some 'feel' for the language, its basic syntax and the minimal structure of a program. Despite the apparent simpleness of the example, such programs vary greatly in their design from language to language.
Kernighan & Ritchie's Hello World
Brian Kernighan and Dennis Ritchie's book The C Programming Language was the first book to use Hello World. The example, essentially as it appeared in the later, ANSI C standard-conformant, edition of the book was as follows:
#include <stdio.h> int main(int argc, char *argv[]) { printf("Hello, World!\n"); return 0; }
External links
The Hello World Collection in more than 300 programming languages