The First C Programme
Author: (Norbert) Suedland, Aalen, Germany
Since Kernighan and Ritchie ([1988KR], chapter 1.1, page 9),
the first and maybe shortest C programme hello.c reads the following:
| #include | | <stdio.h> |
|
| main( ) |
| { |
| printf( "hello, world\n" ) ; |
} |
This programme demonstrates, what can be understood by international:
- A simple programme sends output to the text screen of a console.
- The first statement in a conversation is a greeting.
- The problem of Good morning, Good afternoon, and Good evening, when doing an
international telephone call, here is omitted by Hello.
- The problem of capital letters in the beginning of a sentence, in this example is omitted, too.
- The output is an example, how Americans behave on telephone, if they expect a telephone call from
somewhere else in the world: They use the English language.
In Borland C++ 5, this programme is cited among the examples to be a DOS programme only.
This means:
- Command and file names have got a maximum length of 8 characters.
- Since Windows there is no guarantee, that text console programmes will run in future, too.
- The Unicode concept to represent any written culture language, is to be implemented for
the C programming language, yet.
An English translation hello.English.c of this first C programme would be:
| #include | | <English/standard_input_and_output.header.h> |
|
|
| main_part( ) |
| { |
| print_formatted( "Hello, somewhere in the world!\n" ) ; |
} |
Here, the expression .h for header file remains as abbreviation, thus the Windows system,
looking at the file name endings, will not be perturbated by this translation.