A small, fast, portable systems language — the language of operating systems, embedded devices, databases and the runtimes of most other languages.
A short history
| Year | Milestone |
|---|---|
| 1972 | Dennis Ritchie creates C at Bell Labs (successor of B) to rewrite UNIX. |
| 1978 | The C Programming Language (K&R) by Kernighan & Ritchie — the de-facto standard, “K&R C”. |
| 1989 / 1990 | C89 / C90 — the first ANSI / ISO standard (“ANSI C”). Function prototypes, void, const. |
| 1999 | C99 — // comments, long long, <stdint.h>, bool, VLAs, designated initializers, inline, mixed declarations. |
| 2011 | C11 — _Generic, _Static_assert, anonymous structs/unions, <threads.h>, <stdatomic.h>, _Alignas; gets removed. |
| 2018 | C17 (C18) — bug-fix release of C11, no new features. The default standard for these notes. |
| 2024 | C23 — bool/true/false as keywords, nullptr, constexpr, typeof, #embed, binary literals 0b1010, [[attributes]]. |
Why learn C?
The trade-off
| C gives you | C does NOT give you |
|---|---|
| Raw pointers and manual memory control | Garbage collection, bounds checks, null safety |
| Structs, unions, functions | Classes, inheritance, templates, exceptions |
| A tiny standard library | Built-in strings, lists, maps, networking |
| Speed and control | Protection from undefined behaviour — mistakes compile and silently misbehave |
Hello, world
#include <stdio.h>
int main(void) {
printf("Hello, world!\n");
return 0;
}Hello, world!$ gcc hello.c -o hello # compile (or: clang hello.c -o hello)
$ ./hello # run
Hello, world!
$ echo $? # exit status returned by main
0Is C a high-level or low-level language?
What is the difference between C and C++?