1 Scientific Computing, Department of Informatics and Mathematical Modeling, Technical University of Denmark2 Department of Informatics and Mathematical Modeling, Technical University of Denmark
The principles of C are very much like those of PASCAL, although the syntax differs slightly. The programs are entered in free format, which the programmer may utilise to make the text reader-friendly, and every sentence is ended with a semicolon. Comments can be entered at any point by enclosing them in /* and */. e.g.: /* a comment */. Note that the C compiler is case sensitive. A C program may consist of several program segments. One of them must be the main program, the rest are denoted functions. In contrast to PASCAL the concept procedure does not exist. Every segment starts with a number of declarations, after which follows the executable code. As in PASCAL both global and local variables may be declared. It is possible to combine a program from several separate files, one of which contains the main program, the others functions. This leads to the concept of scope of global variables. To avoid this extra complication, we will in the following consider only C programs contained in a single file.