Previous: 1.3.1 Designing The Algorithm
Up: 1.3 Designing Programs and the C Language
Previous Page: 1.3.1 Designing The Algorithm
Next Page: 1.4 Summary
In this text, our language of choice for implementing algorithms is C.
C was originally developed on a small machine (PDP-11) by Dennis Ritchie for
implementing the UNIX operating system at Bell Laboratories in Murray Hill,
New Jersey (1971-73). C is now used for a wide range of applications including
UNIX implementations, systems programming, scientific and engineering
computation, spreadsheets, and word processing. In fact, the popularity of C
has encouraged the development of a C standard by the American National
Institute of Standards (ANSI).
This text adheres to ANSI C. Major differences between ANSI C and
``old C'' are pointed out in Appendix .
References at the end of this chapter include books by Kernighan and Ritchie
[1, 2], which define both traditional C and ANSI C as well as a
reference to the proposed ANSI C standard by Harbison and Steele[3].
In keeping with the original intent, C is a small language; however, it features modern control flow and data structures and a rich set of operators. C provides a wealth of constructs, or statements, which correspond to good algorithmic structures. C uses a standard library of functions to perform many routine tasks such as input and output and string operations. Since C is oriented towards the use of a library of functions, programs in C tend to be modular with numerous small functional modules. It is also possible for users to develop their own libraries of functions to improve program development.
C is fairly standard; programs written in C are easily moved from one machine to another. Such portability of programs is a major advantage in that applications developed on one computer can be used elsewhere. This allows one to write clear and algorithmically well structured programs. Such a structured programming approach is very important in developing complex, error-free applications.
C provides low level logic operations, normally available only in machine language or assembly language. Low level operations are required for systems programming, such as writing operating systems and other programs at the system level. Today, many operating systems are written in C. C is also suitable for writing scientific and engineering programs, for example it provides double precision computations of real numbers, as well as long integer computation which can be useful in many applications where a large range of integers is required.
As a first programming language C has some weaknesses; however, they can be overcome by discipline in writing programs. In the text, we will indicate items that beginning programmers need to watch out for.