Cloud Parts

C

The small, portable systems language from Bell Labs that Unix, most operating systems and many databases are written in, with memory you allocate and free yourself.

What it is
Programming languages (compiled to machine code)
Type
Open source
Made by
ISO/IEC JTC1/SC22/WG14
License
ISO standard (ISO/IEC 9899:2024); compilers carry their own licences
Facts checked
8 October 2026

What it is

C compiles to machine code with almost nothing between the program and the hardware: no garbage collector, no bounds checks and a tiny runtime. Memory on the heap is requested with malloc and must be handed back with exactly one free; forget it and the program leaks, free it twice or use it afterwards and the behaviour is undefined. The standard leaves many mistakes undefined, such as reading past the end of an array, overflowing a signed integer or dereferencing a null pointer, and compilers are allowed to assume they never happen. That gives optimizers room, and attackers too: the Chromium project finds that around 70% of its serious security bugs are memory-safety problems in C and C++ code.

C isn’t a product but an ISO standard, maintained by the working group ISO/IEC JTC1/SC22/WG14 and implemented by many compilers, such as GCC and Clang, each under its own licence. The language has been revised slowly: ANSI C (C89, adopted by ISO as C90), C99, C11, C17 and C23, published in 2024 as ISO/IEC 9899:2024. C23 makes bool, true and false keywords and adds nullptr, constexpr objects, typeof and #embed, which pulls a binary file into the program at compile time. Current GCC compiles C as gnu23, C23 with GNU extensions, unless told otherwise; Clang accepts -std=c23 since Clang 18.

Why teams pick it

  • The common ground of systems code: Go (cgo), Rust (extern "C") and Zig all call C libraries directly through the C ABI
  • Nothing between the code and the hardware: no runtime, no garbage collector, no hidden checks, which is why Unix itself could be written in it
  • Very stable: the standard changes slowly and cautiously, and GCC still compiles 1989 ANSI C with -std=c90

Watch out for

  • Manual memory management with no bounds checks: in Chromium, about 70% of serious security bugs are memory-safety problems, half of them use-after-free
  • Undefined behaviour is everywhere, from signed overflow to out-of-bounds reads, and compilers aren’t required to diagnose it
  • No standard package manager or build system, so adding a dependency to a C project is hard, especially on Windows

Alternatives

What all compiled to machine code have in common →

How it fits with other technologies

Allocate, use and free heap memory by hand · c

#include <stdio.h>
#include <stdlib.h>

int main(void) {
    size_t n = 5;
    int *squares = malloc(n * sizeof *squares);  /* ask the heap for 5 ints */
    if (squares == NULL) return 1;

    for (size_t i = 0; i < n; i++) squares[i] = (int)(i * i);
    printf("last: %d\n", squares[n - 1]);        /* last: 16 */

    free(squares);    /* you give it back; forget and it leaks */
    squares = NULL;   /* using it after free would be undefined behavior */
    return 0;
}

See it in a real stack

No architecture uses C yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from1972–2024

In 1969 Ken Thompson got the first Unix running, in assembly, on a PDP-7 at Bell Labs, then created B, a typeless language based on BCPL, to replace assembly as its system language. When the team moved to the PDP-11, B fit badly: the machine addressed bytes, not words, characters were clumsy to handle, and B’s compiled code was too slow to rewrite the operating system in. In 1971 Dennis Ritchie began adding a character type to B and made its compiler emit PDP-11 machine code. By 1972 the language was called C, and by early 1973 it had structures and was strong enough that the Unix kernel was rewritten in C that summer.

As Unix spread, so did C. In 1978 Brian Kernighan and Ritchie published The C Programming Language, known as K&R, which served as the language reference for more than ten years. ANSI formed the X3J11 committee in 1983 to write a standard; its report, finished at the end of 1989, was adopted by ISO as ISO/IEC 9899:1990. The committee was conservative on purpose, aiming to codify existing practice; its one big change was function prototypes, borrowed from C++.

Since then WG14 has revised the standard slowly, with C99, C11, C17 (a bug-fix release) and C23: C99 added long long, <stdint.h>, // comments and variable length arrays, C11 added threads, atomics and a memory model, and C23 was published in 2024.

Why it’s built this way

Add types to B
B treated everything as a machine word. On the byte-addressed PDP-11 that made characters awkward, left no room for floating point, and forced a conversion on every pointer use, so Ritchie added char, int and pointers to typed data.
Compile to machine code, not threaded code
B’s interpreter-like threaded code was too slow to replace assembly. Generating real PDP-11 instructions made it possible to write Unix itself in a high-level language.
Leave memory and checks to the programmer
C was built to write an operating system on a small machine with 24K bytes of memory, so it maps closely to the hardware and adds no hidden costs; type safety and interface checking “did not seem as important then as they became later”, as Ritchie wrote.
Standardize existing practice
The ANSI committee set out to codify the C people already used and to make programs portable, rather than invent new features.

Timeline

  1. 1972

    B, extended with types and compiled to machine code, is renamed C

  2. 1973

    The Unix kernel is rewritten in C

  3. 1978

    Kernighan and Ritchie publish The C Programming Language (K&R)

  4. 1989

    ANSI C (C89) is completed; ISO adopts it as C90 in 1990

  5. 1999

    C99 adds long long, <stdint.h>, // comments and variable length arrays

  6. 2011

    C11 adds threads, atomics and a memory model

  7. 2024

    C23 published as ISO/IEC 9899:2024

Sources15 · facts checked 8 October 2026

Improve this page on GitHub