Previous: 2.1.2 Translating the Algorithm to C
Up: 2.1 A Simple C Program
Previous Page: 2.1.2 Translating the Algorithm to C
Next Page: 2.2 Organization of C Programs - Simple Statements
The program is entered and stored in the computer using an editor and saved in a file called pay0.c. The above source program must then be compiled, i.e. translated into a machine language object program using a compiler. Compilation is followed, usually automatically, by a linking process during which the compiled program is joined with other code for functions that may be defined elsewhere. The C language provides a library of standard functions which are linked to every program and are available for use in the program. The end result is an executable machine language program also in a file. The executable machine language program is the only one that can be executed on a machine. We will use the term compilation to mean both compiling and linking to produce an executable program.
When the above program is compiled and executed on a computer, a sample session produces the following on the terminal:
Throughout this text, we will show all information printed by the computer in typewriter style characters. As programs will frequently involve data entry by the user of the program during execution, in a sample session, all information typed in by the user will be shown in slanted characters.