The C Programming Language
C is a general-purpose procedural programming language, developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories in order to re-write the Unix operating system originally developed in assembly language by Ritchie and a colleague, Ken Thompson. The language was called "C" because it was in part derived from an earlier language called "B".
As its origins suggest, C was originally intended for use as a portable systems implementation language, although it has been widely used for developing application software, and is still one of the most popular programming languages worldwide. The relatively low-level nature of the language allows the creation of efficient programs that will run on hardware with limited memory, such as embedded systems.
In 1978, Ritchie and Brian Kernighan (a colleague at Bell Labs who had been an important contributor to the Unix development effort) completed the first edition of a book called "The C Programming Language". The book, published by Prentice-Hall, was regarded by C programmers as the unofficial specification of the language (known as K&R C) for many years.
The popularity of the C programming language meant that it was adopted for the development of software for a wide range of applications and platforms. Many extensions to the language were developed as a consequence, and were subsequently made available as C programming libraries. A library is essentially a set of related functions defined in a separate file. The use of libraries was chosen as the primary means of extending the C programming language.
Due to the large (and growing) number of extensions, and a failure to reach a consensus on a standard library, the American National Standards Institute (ANSI) in 1983 formed a committee to establish a standard specification for C. The standard was duly published in 1989 as ANSI X3.159-1989 "Programming Language C", usually referred to simply as ANSI C.
The ANSI standard was later adopted in a slightly modified form by the International Organisation for Standardization (ISO) as ISO/IEC 9899:1990. The ANSI standard incorporated many of the extensions that had been added to the original K&R specification. The second edition of "The C Programming Language", again written by Kernighan and Ritchie and published by Prentice-Hall, covers the ANSI standard version of the language. The C standard was revised again in the late 1990s resulting in the publication of ISO/IEC 9899:1999 in 1999.
The most recent standard for the C programming language is ISO/IEC 9899:2018 (usually referred to simply as either "C18" or "C17/C18"). This standard does not introduce any new language features, but corrects some of the problems encountered with the previous version of the standard (ISO/IEC 9899:2011, or "C11").
The sample programs provided in the following pages were compiled and run as console applications using Dev-C++ - a free, full-featured integrated development environment (IDE) originally developed by Bloodshed Software and distributed under the GNU General Public License for writing programs in both C and C++. You can download the latest version here.
The code should also work with other C/C++ compilers and IDEs with little or no revision - we have tried many of the sample programs with Microsoft's Visual Studio 2008 and Code::Blocks without encountering any problems.