Like HowStuffWorks on Facebook!

How C Programming Works


What is C?

The simplest way to define C is to call it a computer programming language, meaning you can write software with it that a computer can execute. The result could be a large computer application, like your Web browser, or a tiny set of instructions embedded in a microprocessor or other computer component.

The language C was developed in the early 1970s at Bell Laboratories, primarily credited to the work of Ken Thompson and Dennis Ritchie. Programmers needed a more user-friendly set of instructions for the UNIX operating system, which at the time required programs written in assembly language. Assembly programs, which speak directly to a computer's hardware, are long and difficult to debug, and they required tedious, time-consuming work to add new features [source: King].

Thompson's first attempt at a high-level language was called B, a tribute to the system programming language BCPL on which it was based. When Bell Labs acquired a Digital Equipment Corporation (DEC) UNIX system model PDP-11, Thompson reworked B to better fit the demands of the newer, better system hardware. Thus, B's successor, C, was born. By 1973, C was stable enough that UNIX itself could be rewritten using this innovative new higher-level language [source: King].

Before C could be used effectively beyond Bell Labs, other programmers needed a document that explained how to use it. In 1978, the book "The C Programming Language" by Brian Kernighan and Dennis Ritchie, known by C enthusiasts as K&R or the "White Book," became the definitive source for C programming. As of this writing, the second edition of K&R, originally published in 1988, is still widely available. The original, pre-standard version of C is called K&R C based on that book.

To ensure that people didn't create their own dialects over time, C developers worked through the 1980s to create standards for the language. The U.S. standard for C, American National Standards Institute (ANSI) standard X3.159-1989, became official in 1989. The International Organization for Standardization (ISO) standard, ISO/IEC 9899:1990, followed in 1990. The versions of C after K&R reference these standards and their later revisions (C89, C90 and C99). You might also see C89 referred to as "ANSI C," "ANSI/ISO C" or "ISO C."

C and its use in UNIX was just one part of the boom in operating system development through the 1980s. For all its improvements over its predecessors, though, C was still not effortless to use for developing larger software applications. As computers became more powerful, demand increased for an easier programming experience. This demand prompted programmers to build their own compilers, and thus their own new programming languages, using C. These new languages could simplify coding complex tasks with lots of moving parts. For example, languages like C++ and Java, both developed from C, simplified object-oriented programming, a programming approach that optimizes a programmer's ability to reuse code.

Now that you know a little background, let's look at the mechanics of C itself.