Introduction to C

Niels Christian Albertsen

AbstractThe 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.
TypeTechnical report
Year2006
PublisherInformatics and Mathematical Modelling, Technical University of Denmark, DTU
AddressRichard Petersens Plads, Building 321, DK-2800 Kgs. Lyngby
SeriesIMM-Technical Report-2006-09
Electronic version(s)[pdf]
BibTeX data [bibtex]
IMM Group(s)Scientific Computing, Mathematical Physics