C Notes
Complete history of the C programming language — from its origins at Bell Labs in the 1960s through BCPL, B language, Dennis Ritchie
Understanding where C came from helps you appreciate why it was designed the way it was. C wasn't created in isolation — it was the result of decades of programming language evolution, born out of a very specific need: writing an operating system in a portable, efficient language.
The Timeline at a Glance
The Predecessors: Languages That Led to C
ALGOL 60 (1960)
The story begins with ALGOL (ALGOrithmic Language), an early structured programming language developed by an international committee. ALGOL introduced:
- Block structure with
beginandend - Nested function definitions
- Formal grammar notation (BNF — Backus-Naur Form)
ALGOL was academically elegant but impractical for systems programming because it was too abstract and had no facilities for hardware interaction.
CPL (1963) — Combined Programming Language
Cambridge and the University of London developed CPL to make ALGOL more practical. It was too complex and was never fully implemented, but it planted seeds for simpler successors.
BCPL (1966) — Basic Combined Programming Language
Martin Richards at Cambridge simplified CPL into BCPL. Key features:
- Only one data type (the machine word)
- Could manipulate memory directly
- Good for systems programming
- Used at MIT and Bell Labs
// BCPL syntax (for comparison)
// GET "LIBHDR"
// LET START() BE
// $( WRITES("Hello from BCPL*N") $)B Language (1969-70)
Ken Thompson at Bell Labs created B by simplifying BCPL further. B was used to write early utilities for the UNIX operating system running on the PDP-7 computer.
Limitations of B:
- Typeless — everything was a machine word
- Couldn't handle different data sizes (bytes vs. words)
- Inadequate for the new PDP-11 with its byte-addressable memory
// B language syntax (for comparison)
// main() {
// putchar('hello, world');
// }The Birth of C (1972)
The Problem
When Bell Labs acquired the PDP-11 computer in 1970, Ken Thompson wanted to port UNIX from the PDP-7. But B language couldn't handle the PDP-11's byte-addressable memory and different data sizes efficiently.
The Solution
Dennis MacAlistair Ritchie, a computer scientist at Bell Labs, began evolving B into a new language that could:
- Handle multiple data types (char, int, float)
- Express complex operations concisely
- Generate efficient machine code
- Access memory and hardware directly
- Remain portable across different machines
He called it "C" — simply the next letter after B.
Key Innovations Ritchie Introduced
UNIX Rewritten in C (1973)
The pivotal moment came in 1973 when the entire UNIX operating system was rewritten in C. This was revolutionary because:
- Previously, operating systems were always written in assembly language
- C proved that a high-level language could write efficient system software
- UNIX became portable — it could be recompiled for different hardware
// This concept — an OS written in C — was groundbreaking
// Before C, every OS was tied to specific hardware via assembly
// Conceptual example of early UNIX system call in C:
int open(const char *pathname, int flags) {
// This function talks directly to the hardware
// through a system call mechanism
// Assembly programmers said it couldn't be done efficiently
// Dennis Ritchie proved them wrong
}Impact of UNIX being written in C: - Made UNIX portable across architectures - Established C as THE systems programming language - Led to BSD, Solaris, Linux, and macOS - Proved high-level languages could replace assembly for OS development
The K&R Era (1978)
In 1978, Brian Kernighan and Dennis Ritchie published "The C Programming Language" — universally known as K&R C or "the white book." This book:
- Served as the informal language specification for years
- Introduced the "Hello, World!" tradition
- Became one of the most influential programming books ever written
- Established C's coding style conventions
// The original Hello World from K&R (1978)
// Note: slightly different syntax from modern C
main()
{
printf("hello, world\n");
}K&R C Characteristics
- Functions didn't need to declare parameter types in the definition
- No
voidkeyword - No function prototypes required
intwas the default return type
// K&R style function definition (pre-ANSI)
int max(a, b)
int a, b; // Parameters declared separately!
{
return (a > b) ? a : b;
}
// Modern ANSI C style (what we use today)
int max(int a, int b) {
return (a > b) ? a : b;
}ANSI C / C89 — The First Standard (1989)
By the mid-1980s, C had become wildly popular, but different compilers implemented it differently. The American National Standards Institute (ANSI) formed a committee (X3J11) to create an official standard.
Key Additions in C89/C90
- Function prototypes — declare parameter types in function declarations
voidkeyword — for functions that don't return valuesconstqualifier — for read-only variables- Standard library — formalized
<stdio.h>,<stdlib.h>,<string.h>, etc. enumtype — named integer constantssigned/unsignedkeywords- Locale support — internationalization
// ANSI C introduced function prototypes (1989)
#include <stdio.h>
// Prototype — compiler now knows parameter types
int factorial(int n);
int main(void) { // void means "no parameters"
printf("5! = %d\n", factorial(5));
return 0;
}
int factorial(int n) {
if (n <= 1) return 1;
return n * factorial(n - 1);
}5! = 120
C99 — Modernization (1999)
The C99 standard brought C into the modern era with significant quality-of-life improvements:
Major Additions
0 1 2 3 4 Bool: 1 Fixed-width int32: 42
C11 — Concurrency Support (2011)
C11 addressed the growing need for multi-threaded programming:
Key Additions
<threads.h>— portable threading (thrd_create, mtx_lock)<stdatomic.h>— atomic operations for lock-free programming_Static_assert— compile-time assertions- Anonymous structs and unions
- Type-generic macros —
_Generickeyword - Bounds-checking functions —
gets_s,sprintf_s(optional) aligned_alloc— aligned memory allocation
a is: integer b is: float c is: string Point: (10, 20)
C17 and C23 — Recent Developments
C17 (2018)
C17 was primarily a "bug fix" release with no new features — it clarified ambiguities and fixed defects in C11.
C23 (2023) — Latest Standard
C23 brings several quality-of-life improvements:
typeofoperator — deduce type of expressionnullptr— proper null pointer constant- Binary literals —
0b10110 - Digit separators —
1'000'000 constexpr— compile-time constantsstatic_assertwithout message — simpler syntax- Attributes —
[[deprecated]],[[nodiscard]] #embeddirective — embed binary data in source
The People Behind C
| Person | Contribution |
|---|---|
| Dennis Ritchie | Created C language (1972), co-created UNIX |
| Ken Thompson | Created B language, co-created UNIX, inspired C |
| Brian Kernighan | Co-authored "The C Programming Language" book |
| Martin Richards | Created BCPL, C's ancestor |
| P.J. Plauger | Key contributor to ANSI C standard library |
Dennis Ritchie's Legacy
Dennis Ritchie passed away on October 12, 2011 — just one week after Steve Jobs. While Jobs received worldwide mourning, Ritchie's death was barely covered by mainstream media. Yet Ritchie's contributions arguably had a greater technical impact:
- Created the C language (foundation of most modern software)
- Co-created UNIX (ancestor of Linux, macOS, Android, iOS)
- Received the Turing Award (1983) with Ken Thompson
- His work directly or indirectly powers every smartphone, server, and embedded device today
Interview Questions
Q1: Who created the C language and when?
Answer: C was created by Dennis Ritchie at Bell Laboratories (AT&T) in 1972. It evolved from the B language (created by Ken Thompson in 1969-70), which itself derived from BCPL (1966) by Martin Richards.
Q2: What was the primary motivation for creating C?
Answer: C was created to rewrite the UNIX operating system in a portable high-level language. The B language couldn't handle the PDP-11's byte-addressable memory and multiple data sizes. C added a type system and other features that made it suitable for systems programming while remaining close to hardware.
Q3: What does "K&R C" refer to?
Answer: K&R C refers to the version of C described in the book "The C Programming Language" (1978) by Brian Kernighan and Dennis Ritchie. Before the ANSI standard, this book served as the de facto language specification. K&R C lacked function prototypes and some features added in ANSI C.
Q4: List the major C standards in chronological order.
Answer: (1) K&R C — 1978, (2) ANSI C / C89 — 1989, (3) C99 — 1999, (4) C11 — 2011, (5) C17 — 2018, (6) C23 — 2023. Each standard added features while maintaining backward compatibility with previous versions.
Q5: Why was rewriting UNIX in C considered revolutionary?
Answer: Before UNIX was rewritten in C (1973), all operating systems were written in assembly language, making them tied to specific hardware. Writing an OS in C proved that a high-level language could be efficient enough for system software, and it made UNIX portable — the same source code could be compiled for different computer architectures.
Summary
C was born in 1972 from the practical need to write UNIX in a portable yet efficient language. It evolved from ALGOL → CPL → BCPL → B → C, each step simplifying and adding needed features. The publication of K&R C (1978) spread the language worldwide, ANSI C (1989) standardized it, and subsequent standards (C99, C11, C23) modernized it while maintaining its core philosophy of trust, efficiency, and minimal overhead. Today, C remains the foundation of computing infrastructure — from operating systems and databases to embedded devices and programming language runtimes.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for History of C Programming Language.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this C Programming topic.
Search Terms
c-programming, c programming, programming, introduction, history, history of c programming language
Related C Programming Topics