The C programming language was conceived and developed between 1969 and 1973 by computer scientist Dennis M. Ritchie at AT&T Bell Laboratories in Murray Hill, New Jersey. Its principal motivation was to rewrite the Unix operating system kernel, which was previously implemented in hardware-dependent assembly language on the DEC PDP-11 computer.
C evolved through a distinguished lineage of procedural programming languages:
- ALGOL 60 (1960): Introduced structured block programming and formal language grammars.
- CPL (Combined Programming Language, 1963): Developed jointly by Cambridge and London Universities; highly expressive but exceedingly complex to compile.
- BCPL (Basic Combined Programming Language, 1967): Developed by Martin Richards at Cambridge as a compact, untyped compiler-writing tool.
- B Language (1969): Developed by Ken Thompson at Bell Labs; an untyped, word-oriented distillation of BCPL used in the initial assembly of Unix.
- C Language (1972): Created by Dennis Ritchie by introducing explicit data typing, structures, and pointer arithmetic to the B language, achieving both machine independence and raw hardware efficiency.
- ANSI C (C89/C90): Standardized in 1989 by the American National Standards Institute (ANSI X3.159-1989) and internationally ratified by ISO (ISO/IEC 9899:1990) to eliminate non-standard dialect discrepancies.
Computer scientists categorize programming languages into high-level, low-level, and middle-level based on their abstraction distance from physical computer hardware:
A complete, well-formed C source program consists of six distinct functional sections:
- Documentation Section: Contains comments documenting program intent, author details, algorithms, and revision dates. C supports multi-line block comments (`/* comment */`) and C99 single-line comments (`// comment`). Comments are stripped during preprocessing and generate zero machine instructions.
- Link Section (Preprocessor Directives): Provides instructions to the C preprocessor to include external header files containing standard library declarations (`#include <stdio.h>`, `#include <math.h>`).
- Definition Section: Declares symbolic constants and macro functions using the `#define` directive (`#define PI 3.14159265`, `#define MAX_BUFFER 1024`).
- Global Declaration Section: Declares global variables accessible across all program functions and prototypes of user-defined functions (`int calculate_sum(int, int);`).
- Main Function Header & Body (`main()`): The mandatory entry point of every C executable. Program execution unconditionally commences at `main()`. In modern ANSI C, it has the signature `int main(void)` or `int main(int argc, char *argv[])` and returns an integer exit code to the operating system shell.
- Subprogram Section (User-Defined Functions): Contains the concrete implementation bodies of functions prototyped earlier, promoting modularity and code reuse.